xref: /original-bsd/sys/isofs/cd9660/cd9660_node.h (revision 333da485)
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.1 (Berkeley) 01/21/94
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_chain[2];	/* hash chain, MUST be first */
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 #define	d_forw		d_chain[0]
46 #define	d_back		d_chain[1]
47 #endif
48 
49 struct iso_node {
50 	struct	iso_node *i_chain[2]; /* hash chain, MUST be first */
51 	struct	vnode *i_vnode;	/* vnode associated with this inode */
52 	struct	vnode *i_devvp;	/* vnode for block I/O */
53 	u_long	i_flag;		/* see below */
54 	dev_t	i_dev;		/* device where inode resides */
55 	ino_t	i_number;	/* the identity of the inode */
56 				/* we use the actual starting block of the file */
57 	struct	iso_mnt *i_mnt;	/* filesystem associated with this inode */
58 	struct	lockf *i_lockf;	/* head of byte-level lock list */
59 	doff_t	i_endoff;	/* end of useful stuff in directory */
60 	doff_t	i_diroff;	/* offset in dir, where we found last entry */
61 	doff_t	i_offset;	/* offset of free space in directory */
62 	ino_t	i_ino;		/* inode number of found directory */
63 	long	i_spare0;
64 	long	i_spare1;
65 
66 	long iso_extent;	/* extent of file */
67 	long i_size;
68 	long iso_start;		/* actual start of data of file (may be different */
69 				/* from iso_extent, if file has extended attributes) */
70 	ISO_RRIP_INODE  inode;
71 };
72 
73 #define	i_forw		i_chain[0]
74 #define	i_back		i_chain[1]
75 
76 /* flags */
77 #define	ILOCKED		0x0001		/* inode is locked */
78 #define	IWANT		0x0002		/* some process waiting on lock */
79 #define	IACC		0x0020		/* inode access time to be updated */
80 
81 #define VTOI(vp) ((struct iso_node *)(vp)->v_data)
82 #define ITOV(ip) ((ip)->i_vnode)
83 
84 #define ISO_ILOCK(ip)	iso_ilock(ip)
85 #define ISO_IUNLOCK(ip)	iso_iunlock(ip)
86 
87 /*
88  * Prototypes for ISOFS vnode operations
89  */
90 int isofs_lookup __P((struct vop_lookup_args *));
91 int isofs_open __P((struct vop_open_args *));
92 int isofs_close __P((struct vop_close_args *));
93 int isofs_access __P((struct vop_access_args *));
94 int isofs_getattr __P((struct vop_getattr_args *));
95 int isofs_read __P((struct vop_read_args *));
96 int isofs_ioctl __P((struct vop_ioctl_args *));
97 int isofs_select __P((struct vop_select_args *));
98 int isofs_mmap __P((struct vop_mmap_args *));
99 int isofs_seek __P((struct vop_seek_args *));
100 int isofs_readdir __P((struct vop_readdir_args *));
101 int isofs_abortop __P((struct vop_abortop_args *));
102 int isofs_inactive __P((struct vop_inactive_args *));
103 int isofs_reclaim __P((struct vop_reclaim_args *));
104 int isofs_bmap __P((struct vop_bmap_args *));
105 int isofs_lock __P((struct vop_lock_args *));
106 int isofs_unlock __P((struct vop_unlock_args *));
107 int isofs_strategy __P((struct vop_strategy_args *));
108 int isofs_print __P((struct vop_print_args *));
109 int isofs_islocked __P((struct vop_islocked_args *));
110 void isofs_defattr __P((struct iso_directory_record *,
111 			struct iso_node *, struct buf *));
112 void isofs_deftstamp __P((struct iso_directory_record *,
113 			struct iso_node *, struct buf *));
114 #ifdef	ISODEVMAP
115 struct iso_dnode *iso_dmap __P((dev_t, ino_t, int));
116 void iso_dunmap __P((dev_t));
117 #endif
118