xref: /original-bsd/sys/isofs/cd9660/cd9660_node.h (revision 95fda334)
1 /*-
2  * Copyright (c) 1994
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed to Berkeley
6  * by Pace Willisson (pace@blitz.com).  The Rock Ridge Extension
7  * Support code is derived from software contributed to Berkeley
8  * by Atsushi Murai (amurai@spec.co.jp).
9  *
10  * %sccs.include.redist.c%
11  *
12  *	@(#)cd9660_node.h	8.6 (Berkeley) 05/14/95
13  */
14 
15 /*
16  * Theoretically, directories can be more than 2Gb in length,
17  * however, in practice this seems unlikely. So, we define
18  * the type doff_t as a long to keep down the cost of doing
19  * lookup on a 32-bit machine. If you are porting to a 64-bit
20  * architecture, you should make doff_t the same as off_t.
21  */
22 #define doff_t	long
23 
24 typedef	struct	{
25 	struct timespec	iso_atime;	/* time of last access */
26 	struct timespec	iso_mtime;	/* time of last modification */
27 	struct timespec	iso_ctime;	/* time file changed */
28 	u_short		iso_mode;	/* files access mode and type */
29 	uid_t		iso_uid;	/* owner user id */
30 	gid_t		iso_gid;	/* owner group id */
31 	short		iso_links;	/* links of file */
32 	dev_t		iso_rdev;	/* Major/Minor number for special */
33 } ISO_RRIP_INODE;
34 
35 #ifdef ISODEVMAP
36 /*
37  * FOr device# (major,minor) translation table
38  */
39 struct iso_dnode {
40 	struct iso_dnode *d_next, **d_prev;	/* hash chain */
41 	dev_t		i_dev;		/* device where dnode resides */
42 	ino_t		i_number;	/* the identity of the inode */
43 	dev_t		d_dev;		/* device # for translation */
44 };
45 #endif
46 
47 struct iso_node {
48 	struct	iso_node *i_next, **i_prev;	/* hash chain */
49 	struct	vnode *i_vnode;	/* vnode associated with this inode */
50 	struct	vnode *i_devvp;	/* vnode for block I/O */
51 	u_long	i_flag;		/* see below */
52 	dev_t	i_dev;		/* device where inode resides */
53 	ino_t	i_number;	/* the identity of the inode */
54 				/* we use the actual starting block of the file */
55 	struct	iso_mnt *i_mnt;	/* filesystem associated with this inode */
56 	struct	lockf *i_lockf;	/* head of byte-level lock list */
57 	doff_t	i_endoff;	/* end of useful stuff in directory */
58 	doff_t	i_diroff;	/* offset in dir, where we found last entry */
59 	doff_t	i_offset;	/* offset of free space in directory */
60 	ino_t	i_ino;		/* inode number of found directory */
61 	struct	lock i_lock;	/* node lock */
62 
63 	long iso_extent;	/* extent of file */
64 	long i_size;
65 	long iso_start;		/* actual start of data of file (may be different */
66 				/* from iso_extent, if file has extended attributes) */
67 	ISO_RRIP_INODE  inode;
68 };
69 
70 #define	i_forw		i_chain[0]
71 #define	i_back		i_chain[1]
72 
73 /* flags */
74 #define	IN_ACCESS	0x0020		/* inode access time to be updated */
75 
76 #define VTOI(vp) ((struct iso_node *)(vp)->v_data)
77 #define ITOV(ip) ((ip)->i_vnode)
78 
79 /*
80  * Prototypes for ISOFS vnode operations
81  */
82 int cd9660_lookup __P((struct vop_lookup_args *));
83 int cd9660_open __P((struct vop_open_args *));
84 int cd9660_close __P((struct vop_close_args *));
85 int cd9660_access __P((struct vop_access_args *));
86 int cd9660_getattr __P((struct vop_getattr_args *));
87 int cd9660_read __P((struct vop_read_args *));
88 int cd9660_ioctl __P((struct vop_ioctl_args *));
89 int cd9660_select __P((struct vop_select_args *));
90 int cd9660_mmap __P((struct vop_mmap_args *));
91 int cd9660_seek __P((struct vop_seek_args *));
92 int cd9660_readdir __P((struct vop_readdir_args *));
93 int cd9660_abortop __P((struct vop_abortop_args *));
94 int cd9660_inactive __P((struct vop_inactive_args *));
95 int cd9660_reclaim __P((struct vop_reclaim_args *));
96 int cd9660_bmap __P((struct vop_bmap_args *));
97 int cd9660_lock __P((struct vop_lock_args *));
98 int cd9660_unlock __P((struct vop_unlock_args *));
99 int cd9660_strategy __P((struct vop_strategy_args *));
100 int cd9660_print __P((struct vop_print_args *));
101 int cd9660_islocked __P((struct vop_islocked_args *));
102 int cd9660_pathconf __P((struct vop_pathconf_args *));
103 int cd9660_blkatoff __P((struct vop_blkatoff_args *));
104 #define cd9660_revoke vop_revoke
105 
106 void cd9660_defattr __P((struct iso_directory_record *,
107 			struct iso_node *, struct buf *));
108 void cd9660_deftstamp __P((struct iso_directory_record *,
109 			struct iso_node *, struct buf *));
110 struct vnode *cd9660_ihashget __P((dev_t, ino_t));
111 void cd9660_ihashins __P((struct iso_node *));
112 void cd9660_ihashrem __P((struct iso_node *));
113 int cd9660_tstamp_conv7 __P((u_char *, struct timespec *));
114 int cd9660_tstamp_conv17 __P((u_char *, struct timespec *));
115 ino_t isodirino __P((struct iso_directory_record *, struct iso_mnt *));
116 #ifdef	ISODEVMAP
117 struct iso_dnode *iso_dmap __P((dev_t, ino_t, int));
118 void iso_dunmap __P((dev_t));
119 #endif
120