xref: /minix3/sys/fs/cd9660/cd9660_node.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: cd9660_node.c,v 1.34 2014/11/10 18:46:33 maxv Exp $	*/
284d9c625SLionel Sambuc 
384d9c625SLionel Sambuc /*-
484d9c625SLionel Sambuc  * Copyright (c) 1982, 1986, 1989, 1994
584d9c625SLionel Sambuc  *	The Regents of the University of California.  All rights reserved.
684d9c625SLionel Sambuc  *
784d9c625SLionel Sambuc  * This code is derived from software contributed to Berkeley
884d9c625SLionel Sambuc  * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
984d9c625SLionel Sambuc  * Support code is derived from software contributed to Berkeley
1084d9c625SLionel Sambuc  * by Atsushi Murai (amurai@spec.co.jp).
1184d9c625SLionel Sambuc  *
1284d9c625SLionel Sambuc  * Redistribution and use in source and binary forms, with or without
1384d9c625SLionel Sambuc  * modification, are permitted provided that the following conditions
1484d9c625SLionel Sambuc  * are met:
1584d9c625SLionel Sambuc  * 1. Redistributions of source code must retain the above copyright
1684d9c625SLionel Sambuc  *    notice, this list of conditions and the following disclaimer.
1784d9c625SLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright
1884d9c625SLionel Sambuc  *    notice, this list of conditions and the following disclaimer in the
1984d9c625SLionel Sambuc  *    documentation and/or other materials provided with the distribution.
2084d9c625SLionel Sambuc  * 3. Neither the name of the University nor the names of its contributors
2184d9c625SLionel Sambuc  *    may be used to endorse or promote products derived from this software
2284d9c625SLionel Sambuc  *    without specific prior written permission.
2384d9c625SLionel Sambuc  *
2484d9c625SLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2584d9c625SLionel Sambuc  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2684d9c625SLionel Sambuc  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2784d9c625SLionel Sambuc  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2884d9c625SLionel Sambuc  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2984d9c625SLionel Sambuc  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3084d9c625SLionel Sambuc  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3184d9c625SLionel Sambuc  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3284d9c625SLionel Sambuc  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3384d9c625SLionel Sambuc  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3484d9c625SLionel Sambuc  * SUCH DAMAGE.
3584d9c625SLionel Sambuc  *
3684d9c625SLionel Sambuc  *	@(#)cd9660_node.c	8.8 (Berkeley) 5/22/95
3784d9c625SLionel Sambuc  */
3884d9c625SLionel Sambuc 
3984d9c625SLionel Sambuc #include <sys/cdefs.h>
40*0a6a1f1dSLionel Sambuc __KERNEL_RCSID(0, "$NetBSD: cd9660_node.c,v 1.34 2014/11/10 18:46:33 maxv Exp $");
4184d9c625SLionel Sambuc 
4284d9c625SLionel Sambuc #include <sys/param.h>
4384d9c625SLionel Sambuc #include <sys/systm.h>
4484d9c625SLionel Sambuc #include <sys/mount.h>
4584d9c625SLionel Sambuc #include <sys/proc.h>
4684d9c625SLionel Sambuc #include <sys/file.h>
4784d9c625SLionel Sambuc #include <sys/buf.h>
4884d9c625SLionel Sambuc #include <sys/vnode.h>
4984d9c625SLionel Sambuc #include <sys/namei.h>
5084d9c625SLionel Sambuc #include <sys/kernel.h>
5184d9c625SLionel Sambuc #include <sys/pool.h>
5284d9c625SLionel Sambuc #include <sys/stat.h>
5384d9c625SLionel Sambuc 
5484d9c625SLionel Sambuc #include <fs/cd9660/iso.h>
5584d9c625SLionel Sambuc #include <fs/cd9660/cd9660_extern.h>
5684d9c625SLionel Sambuc #include <fs/cd9660/cd9660_node.h>
5784d9c625SLionel Sambuc #include <fs/cd9660/cd9660_mount.h>
5884d9c625SLionel Sambuc #include <fs/cd9660/iso_rrip.h>
5984d9c625SLionel Sambuc 
6084d9c625SLionel Sambuc extern int prtactive;	/* 1 => print out reclaim of active vnodes */
6184d9c625SLionel Sambuc 
6284d9c625SLionel Sambuc struct pool cd9660_node_pool;
6384d9c625SLionel Sambuc 
6484d9c625SLionel Sambuc static u_int cd9660_chars2ui(const u_char *, int);
6584d9c625SLionel Sambuc 
6684d9c625SLionel Sambuc /*
67*0a6a1f1dSLionel Sambuc  * Initialize pool for nodes.
6884d9c625SLionel Sambuc  */
6984d9c625SLionel Sambuc void
cd9660_init(void)7084d9c625SLionel Sambuc cd9660_init(void)
7184d9c625SLionel Sambuc {
7284d9c625SLionel Sambuc 
7384d9c625SLionel Sambuc 	malloc_type_attach(M_ISOFSMNT);
7484d9c625SLionel Sambuc 	pool_init(&cd9660_node_pool, sizeof(struct iso_node), 0, 0, 0,
7584d9c625SLionel Sambuc 	    "cd9660nopl", &pool_allocator_nointr, IPL_NONE);
7684d9c625SLionel Sambuc }
7784d9c625SLionel Sambuc 
7884d9c625SLionel Sambuc /*
79*0a6a1f1dSLionel Sambuc  * Reinitialize.
8084d9c625SLionel Sambuc  */
8184d9c625SLionel Sambuc 
8284d9c625SLionel Sambuc void
cd9660_reinit(void)8384d9c625SLionel Sambuc cd9660_reinit(void)
8484d9c625SLionel Sambuc {
8584d9c625SLionel Sambuc 
8684d9c625SLionel Sambuc }
8784d9c625SLionel Sambuc 
8884d9c625SLionel Sambuc /*
89*0a6a1f1dSLionel Sambuc  * Destroy node pool.
9084d9c625SLionel Sambuc  */
9184d9c625SLionel Sambuc void
cd9660_done(void)9284d9c625SLionel Sambuc cd9660_done(void)
9384d9c625SLionel Sambuc {
9484d9c625SLionel Sambuc 	pool_destroy(&cd9660_node_pool);
9584d9c625SLionel Sambuc 	malloc_type_detach(M_ISOFSMNT);
9684d9c625SLionel Sambuc }
9784d9c625SLionel Sambuc 
9884d9c625SLionel Sambuc /*
9984d9c625SLionel Sambuc  * Last reference to an inode, write the inode out and if necessary,
10084d9c625SLionel Sambuc  * truncate and deallocate the file.
10184d9c625SLionel Sambuc  */
10284d9c625SLionel Sambuc int
cd9660_inactive(void * v)10384d9c625SLionel Sambuc cd9660_inactive(void *v)
10484d9c625SLionel Sambuc {
10584d9c625SLionel Sambuc 	struct vop_inactive_args /* {
10684d9c625SLionel Sambuc 		struct vnode *a_vp;
10784d9c625SLionel Sambuc 		bool *a_recycle;
10884d9c625SLionel Sambuc 	} */ *ap = v;
10984d9c625SLionel Sambuc 	struct vnode *vp = ap->a_vp;
11084d9c625SLionel Sambuc 	struct iso_node *ip = VTOI(vp);
11184d9c625SLionel Sambuc 	int error = 0;
11284d9c625SLionel Sambuc 
11384d9c625SLionel Sambuc 	/*
11484d9c625SLionel Sambuc 	 * If we are done with the inode, reclaim it
11584d9c625SLionel Sambuc 	 * so that it can be reused immediately.
11684d9c625SLionel Sambuc 	 */
11784d9c625SLionel Sambuc 	ip->i_flag = 0;
11884d9c625SLionel Sambuc 	*ap->a_recycle = (ip->inode.iso_mode == 0);
11984d9c625SLionel Sambuc 	VOP_UNLOCK(vp);
12084d9c625SLionel Sambuc 	return error;
12184d9c625SLionel Sambuc }
12284d9c625SLionel Sambuc 
12384d9c625SLionel Sambuc /*
12484d9c625SLionel Sambuc  * Reclaim an inode so that it can be used for other purposes.
12584d9c625SLionel Sambuc  */
12684d9c625SLionel Sambuc int
cd9660_reclaim(void * v)12784d9c625SLionel Sambuc cd9660_reclaim(void *v)
12884d9c625SLionel Sambuc {
12984d9c625SLionel Sambuc 	struct vop_reclaim_args /* {
13084d9c625SLionel Sambuc 		struct vnode *a_vp;
13184d9c625SLionel Sambuc 		struct lwp *a_l;
13284d9c625SLionel Sambuc 	} */ *ap = v;
13384d9c625SLionel Sambuc 	struct vnode *vp = ap->a_vp;
13484d9c625SLionel Sambuc 	struct iso_node *ip = VTOI(vp);
13584d9c625SLionel Sambuc 
13684d9c625SLionel Sambuc 	if (prtactive && vp->v_usecount > 1)
13784d9c625SLionel Sambuc 		vprint("cd9660_reclaim: pushing active", vp);
13884d9c625SLionel Sambuc 	/*
139*0a6a1f1dSLionel Sambuc 	 * Remove the inode from the vnode cache.
14084d9c625SLionel Sambuc 	 */
141*0a6a1f1dSLionel Sambuc 	vcache_remove(vp->v_mount, &ip->i_number, sizeof(ip->i_number));
14284d9c625SLionel Sambuc 	/*
14384d9c625SLionel Sambuc 	 * Purge old data structures associated with the inode.
14484d9c625SLionel Sambuc 	 */
14584d9c625SLionel Sambuc 	genfs_node_destroy(vp);
14684d9c625SLionel Sambuc 	pool_put(&cd9660_node_pool, vp->v_data);
14784d9c625SLionel Sambuc 	vp->v_data = NULL;
14884d9c625SLionel Sambuc 	return (0);
14984d9c625SLionel Sambuc }
15084d9c625SLionel Sambuc 
15184d9c625SLionel Sambuc /*
15284d9c625SLionel Sambuc  * File attributes
15384d9c625SLionel Sambuc  */
15484d9c625SLionel Sambuc void
cd9660_defattr(struct iso_directory_record * isodir,struct iso_node * inop,struct buf * bp)15584d9c625SLionel Sambuc cd9660_defattr(struct iso_directory_record *isodir, struct iso_node *inop,
15684d9c625SLionel Sambuc 	struct buf *bp)
15784d9c625SLionel Sambuc {
15884d9c625SLionel Sambuc 	struct buf *bp2 = NULL;
15984d9c625SLionel Sambuc 	struct iso_mnt *imp;
16084d9c625SLionel Sambuc 	struct iso_extended_attributes *ap = NULL;
16184d9c625SLionel Sambuc 	int off;
16284d9c625SLionel Sambuc 
16384d9c625SLionel Sambuc 	if (isonum_711(isodir->flags)&2) {
16484d9c625SLionel Sambuc 		inop->inode.iso_mode = S_IFDIR;
16584d9c625SLionel Sambuc 		/*
16684d9c625SLionel Sambuc 		 * If we return 2, fts() will assume there are no subdirectories
16784d9c625SLionel Sambuc 		 * (just links for the path and .), so instead we return 1.
16884d9c625SLionel Sambuc 		 */
16984d9c625SLionel Sambuc 		inop->inode.iso_links = 1;
17084d9c625SLionel Sambuc 	} else {
17184d9c625SLionel Sambuc 		inop->inode.iso_mode = S_IFREG;
17284d9c625SLionel Sambuc 		inop->inode.iso_links = 1;
17384d9c625SLionel Sambuc 	}
17484d9c625SLionel Sambuc 	if (!bp
17584d9c625SLionel Sambuc 	    && ((imp = inop->i_mnt)->im_flags & ISOFSMNT_EXTATT)
17684d9c625SLionel Sambuc 	    && (off = isonum_711(isodir->ext_attr_length))) {
17784d9c625SLionel Sambuc 		cd9660_blkatoff(ITOV(inop), (off_t)-(off << imp->im_bshift),
17884d9c625SLionel Sambuc 		    NULL, &bp2);
17984d9c625SLionel Sambuc 		bp = bp2;
18084d9c625SLionel Sambuc 	}
18184d9c625SLionel Sambuc 	if (bp) {
18284d9c625SLionel Sambuc 		ap = (struct iso_extended_attributes *)bp->b_data;
18384d9c625SLionel Sambuc 
18484d9c625SLionel Sambuc 		if (isonum_711(ap->version) == 1) {
18584d9c625SLionel Sambuc 			if (!(ap->perm[1]&0x10))
18684d9c625SLionel Sambuc 				inop->inode.iso_mode |= S_IRUSR;
18784d9c625SLionel Sambuc 			if (!(ap->perm[1]&0x40))
18884d9c625SLionel Sambuc 				inop->inode.iso_mode |= S_IXUSR;
18984d9c625SLionel Sambuc 			if (!(ap->perm[0]&0x01))
19084d9c625SLionel Sambuc 				inop->inode.iso_mode |= S_IRGRP;
19184d9c625SLionel Sambuc 			if (!(ap->perm[0]&0x04))
19284d9c625SLionel Sambuc 				inop->inode.iso_mode |= S_IXGRP;
19384d9c625SLionel Sambuc 			if (!(ap->perm[0]&0x10))
19484d9c625SLionel Sambuc 				inop->inode.iso_mode |= S_IROTH;
19584d9c625SLionel Sambuc 			if (!(ap->perm[0]&0x40))
19684d9c625SLionel Sambuc 				inop->inode.iso_mode |= S_IXOTH;
19784d9c625SLionel Sambuc 			inop->inode.iso_uid = isonum_723(ap->owner); /* what about 0? */
19884d9c625SLionel Sambuc 			inop->inode.iso_gid = isonum_723(ap->group); /* what about 0? */
19984d9c625SLionel Sambuc 		} else
20084d9c625SLionel Sambuc 			ap = NULL;
20184d9c625SLionel Sambuc 	}
20284d9c625SLionel Sambuc 	if (!ap) {
20384d9c625SLionel Sambuc 		inop->inode.iso_mode |=
20484d9c625SLionel Sambuc 		    S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH;
20584d9c625SLionel Sambuc 		inop->inode.iso_uid = (uid_t)0;
20684d9c625SLionel Sambuc 		inop->inode.iso_gid = (gid_t)0;
20784d9c625SLionel Sambuc 	}
20884d9c625SLionel Sambuc 	if (bp2)
20984d9c625SLionel Sambuc 		brelse(bp2, 0);
21084d9c625SLionel Sambuc }
21184d9c625SLionel Sambuc 
21284d9c625SLionel Sambuc /*
21384d9c625SLionel Sambuc  * Time stamps
21484d9c625SLionel Sambuc  */
21584d9c625SLionel Sambuc void
cd9660_deftstamp(struct iso_directory_record * isodir,struct iso_node * inop,struct buf * bp)21684d9c625SLionel Sambuc cd9660_deftstamp(struct iso_directory_record *isodir, struct iso_node *inop,
21784d9c625SLionel Sambuc 	struct buf *bp)
21884d9c625SLionel Sambuc {
21984d9c625SLionel Sambuc 	struct buf *bp2 = NULL;
22084d9c625SLionel Sambuc 	struct iso_mnt *imp;
22184d9c625SLionel Sambuc 	struct iso_extended_attributes *ap = NULL;
22284d9c625SLionel Sambuc 	int off;
22384d9c625SLionel Sambuc 
22484d9c625SLionel Sambuc 	if (!bp
22584d9c625SLionel Sambuc 	    && ((imp = inop->i_mnt)->im_flags & ISOFSMNT_EXTATT)
22684d9c625SLionel Sambuc 	    && (off = isonum_711(isodir->ext_attr_length))) {
22784d9c625SLionel Sambuc 		cd9660_blkatoff(ITOV(inop), (off_t)-(off << imp->im_bshift),
22884d9c625SLionel Sambuc 		    NULL, &bp2);
22984d9c625SLionel Sambuc 		bp = bp2;
23084d9c625SLionel Sambuc 	}
23184d9c625SLionel Sambuc 	if (bp) {
23284d9c625SLionel Sambuc 		ap = (struct iso_extended_attributes *)bp->b_data;
23384d9c625SLionel Sambuc 
23484d9c625SLionel Sambuc 		if (isonum_711(ap->version) == 1) {
23584d9c625SLionel Sambuc 			if (!cd9660_tstamp_conv17(ap->ftime,&inop->inode.iso_atime))
23684d9c625SLionel Sambuc 				cd9660_tstamp_conv17(ap->ctime,&inop->inode.iso_atime);
23784d9c625SLionel Sambuc 			if (!cd9660_tstamp_conv17(ap->ctime,&inop->inode.iso_ctime))
23884d9c625SLionel Sambuc 				inop->inode.iso_ctime = inop->inode.iso_atime;
23984d9c625SLionel Sambuc 			if (!cd9660_tstamp_conv17(ap->mtime,&inop->inode.iso_mtime))
24084d9c625SLionel Sambuc 				inop->inode.iso_mtime = inop->inode.iso_ctime;
24184d9c625SLionel Sambuc 		} else
24284d9c625SLionel Sambuc 			ap = NULL;
24384d9c625SLionel Sambuc 	}
24484d9c625SLionel Sambuc 	if (!ap) {
24584d9c625SLionel Sambuc 		cd9660_tstamp_conv7(isodir->date,&inop->inode.iso_ctime);
24684d9c625SLionel Sambuc 		inop->inode.iso_atime = inop->inode.iso_ctime;
24784d9c625SLionel Sambuc 		inop->inode.iso_mtime = inop->inode.iso_ctime;
24884d9c625SLionel Sambuc 	}
24984d9c625SLionel Sambuc 	if (bp2)
25084d9c625SLionel Sambuc 		brelse(bp2, 0);
25184d9c625SLionel Sambuc }
25284d9c625SLionel Sambuc 
25384d9c625SLionel Sambuc int
cd9660_tstamp_conv7(const u_char * pi,struct timespec * pu)25484d9c625SLionel Sambuc cd9660_tstamp_conv7(const u_char *pi, struct timespec *pu)
25584d9c625SLionel Sambuc {
25684d9c625SLionel Sambuc 	int crtime, days;
25784d9c625SLionel Sambuc 	int y, m, d, hour, minute, second, tz;
25884d9c625SLionel Sambuc 
25984d9c625SLionel Sambuc 	y = pi[0] + 1900;
26084d9c625SLionel Sambuc 	m = pi[1];
26184d9c625SLionel Sambuc 	d = pi[2];
26284d9c625SLionel Sambuc 	hour = pi[3];
26384d9c625SLionel Sambuc 	minute = pi[4];
26484d9c625SLionel Sambuc 	second = pi[5];
26584d9c625SLionel Sambuc 	tz = pi[6];
26684d9c625SLionel Sambuc 
26784d9c625SLionel Sambuc 	if (y < 1970) {
26884d9c625SLionel Sambuc 		pu->tv_sec  = 0;
26984d9c625SLionel Sambuc 		pu->tv_nsec = 0;
27084d9c625SLionel Sambuc 		return 0;
27184d9c625SLionel Sambuc 	} else {
27284d9c625SLionel Sambuc #ifdef	ORIGINAL
27384d9c625SLionel Sambuc 		/* computes day number relative to Sept. 19th,1989 */
27484d9c625SLionel Sambuc 		/* don't even *THINK* about changing formula. It works! */
27584d9c625SLionel Sambuc 		days = 367*(y-1980)-7*(y+(m+9)/12)/4-3*((y+(m-9)/7)/100+1)/4+275*m/9+d-100;
27684d9c625SLionel Sambuc #else
27784d9c625SLionel Sambuc 		/*
27884d9c625SLionel Sambuc 		 * Changed :-) to make it relative to Jan. 1st, 1970
27984d9c625SLionel Sambuc 		 * and to disambiguate negative division
28084d9c625SLionel Sambuc 		 */
28184d9c625SLionel Sambuc 		days = 367*(y-1960)-7*(y+(m+9)/12)/4-3*((y+(m+9)/12-1)/100+1)/4+275*m/9+d-239;
28284d9c625SLionel Sambuc #endif
28384d9c625SLionel Sambuc 		crtime = ((((days * 24) + hour) * 60 + minute) * 60) + second;
28484d9c625SLionel Sambuc 
28584d9c625SLionel Sambuc 		/* timezone offset is unreliable on some disks */
28684d9c625SLionel Sambuc 		if (-48 <= tz && tz <= 52)
28784d9c625SLionel Sambuc 			crtime -= tz * 15 * 60;
28884d9c625SLionel Sambuc 	}
28984d9c625SLionel Sambuc 	pu->tv_sec  = crtime;
29084d9c625SLionel Sambuc 	pu->tv_nsec = 0;
29184d9c625SLionel Sambuc 	return 1;
29284d9c625SLionel Sambuc }
29384d9c625SLionel Sambuc 
29484d9c625SLionel Sambuc static u_int
cd9660_chars2ui(const u_char * begin,int len)29584d9c625SLionel Sambuc cd9660_chars2ui(const u_char *begin, int len)
29684d9c625SLionel Sambuc {
29784d9c625SLionel Sambuc 	u_int rc;
29884d9c625SLionel Sambuc 
29984d9c625SLionel Sambuc 	for (rc = 0; --len >= 0;) {
30084d9c625SLionel Sambuc 		rc *= 10;
30184d9c625SLionel Sambuc 		rc += *begin++ - '0';
30284d9c625SLionel Sambuc 	}
30384d9c625SLionel Sambuc 	return rc;
30484d9c625SLionel Sambuc }
30584d9c625SLionel Sambuc 
30684d9c625SLionel Sambuc int
cd9660_tstamp_conv17(const u_char * pi,struct timespec * pu)30784d9c625SLionel Sambuc cd9660_tstamp_conv17(const u_char *pi, struct timespec *pu)
30884d9c625SLionel Sambuc {
30984d9c625SLionel Sambuc 	u_char tbuf[7];
31084d9c625SLionel Sambuc 
31184d9c625SLionel Sambuc 	/* year:"0001"-"9999" -> -1900  */
31284d9c625SLionel Sambuc 	tbuf[0] = cd9660_chars2ui(pi,4) - 1900;
31384d9c625SLionel Sambuc 
31484d9c625SLionel Sambuc 	/* month: " 1"-"12"      -> 1 - 12 */
31584d9c625SLionel Sambuc 	tbuf[1] = cd9660_chars2ui(pi + 4,2);
31684d9c625SLionel Sambuc 
31784d9c625SLionel Sambuc 	/* day:   " 1"-"31"      -> 1 - 31 */
31884d9c625SLionel Sambuc 	tbuf[2] = cd9660_chars2ui(pi + 6,2);
31984d9c625SLionel Sambuc 
32084d9c625SLionel Sambuc 	/* hour:  " 0"-"23"      -> 0 - 23 */
32184d9c625SLionel Sambuc 	tbuf[3] = cd9660_chars2ui(pi + 8,2);
32284d9c625SLionel Sambuc 
32384d9c625SLionel Sambuc 	/* minute:" 0"-"59"      -> 0 - 59 */
32484d9c625SLionel Sambuc 	tbuf[4] = cd9660_chars2ui(pi + 10,2);
32584d9c625SLionel Sambuc 
32684d9c625SLionel Sambuc 	/* second:" 0"-"59"      -> 0 - 59 */
32784d9c625SLionel Sambuc 	tbuf[5] = cd9660_chars2ui(pi + 12,2);
32884d9c625SLionel Sambuc 
32984d9c625SLionel Sambuc 	/* difference of GMT */
33084d9c625SLionel Sambuc 	tbuf[6] = pi[16];
33184d9c625SLionel Sambuc 
33284d9c625SLionel Sambuc 	return cd9660_tstamp_conv7(tbuf,pu);
33384d9c625SLionel Sambuc }
33484d9c625SLionel Sambuc 
33584d9c625SLionel Sambuc ino_t
isodirino(struct iso_directory_record * isodir,struct iso_mnt * imp)33684d9c625SLionel Sambuc isodirino(struct iso_directory_record *isodir, struct iso_mnt *imp)
33784d9c625SLionel Sambuc {
33884d9c625SLionel Sambuc 	ino_t ino;
33984d9c625SLionel Sambuc 
340*0a6a1f1dSLionel Sambuc 	/*
341*0a6a1f1dSLionel Sambuc 	 * Note there is an inverse calculation in
342*0a6a1f1dSLionel Sambuc 	 * cd9660_vfsops.c:cd9660_loadvnode():
343*0a6a1f1dSLionel Sambuc 	 *   ip->iso_start = ino >> imp->im_bshift;
344*0a6a1f1dSLionel Sambuc 	 * and also a calculation of the isodir pointer
345*0a6a1f1dSLionel Sambuc 	 * from an inode in cd9660_vnops.c:cd9660_readlink()
346*0a6a1f1dSLionel Sambuc 	 */
347*0a6a1f1dSLionel Sambuc 	ino = ((ino_t)isonum_733(isodir->extent) +
348*0a6a1f1dSLionel Sambuc 		isonum_711(isodir->ext_attr_length)) << imp->im_bshift;
349*0a6a1f1dSLionel Sambuc 	return ino;
35084d9c625SLionel Sambuc }
351