xref: /NextBSD/sys/gnu/fs/reiserfs/reiserfs_fs_i.h (revision b137080f19736ee33fede2e88bb54438604cf86b)
1 /*-
2  * Copyright 2000 Hans Reiser
3  * See README for licensing and copyright details
4  *
5  * Ported to FreeBSD by Jean-Sébastien Pédron <jspedron@club-internet.fr>
6  *
7  * $FreeBSD$
8  */
9 
10 #ifndef _GNU_REISERFS_REISERFS_FS_I_H
11 #define _GNU_REISERFS_REISERFS_FS_I_H
12 
13 #include <sys/queue.h>
14 
15 /* Bitmasks for i_flags field in reiserfs-specific part of inode */
16 typedef enum {
17 	/*
18 	 * This says what format of key do all items (but stat data) of
19 	 * an object have.  If this is set, that format is 3.6 otherwise
20 	 * - 3.5
21 	 */
22 	i_item_key_version_mask		= 0x0001,
23 	/* If this is unset, object has 3.5 stat data, otherwise, it has
24 	 * 3.6 stat data with 64bit size, 32bit nlink etc. */
25 	i_stat_data_version_mask	= 0x0002,
26 	/* File might need tail packing on close */
27 	i_pack_on_close_mask		= 0x0004,
28 	/* Don't pack tail of file */
29 	i_nopack_mask			= 0x0008,
30 	/* If those is set, "safe link" was created for this file during
31 	 * truncate or unlink. Safe link is used to avoid leakage of disk
32 	 * space on crash with some files open, but unlinked. */
33 	i_link_saved_unlink_mask	= 0x0010,
34 	i_link_saved_truncate_mask	= 0x0020,
35 	i_priv_object			= 0x0080,
36 	i_has_xattr_dir			= 0x0100,
37 } reiserfs_inode_flags;
38 
39 struct reiserfs_node {
40 	struct vnode	*i_vnode;
41 	struct vnode	*i_devvp;
42 	struct cdev	*i_dev;
43 	ino_t		 i_number;
44 
45 	ino_t		 i_ino;
46 
47 	struct reiserfs_sb_info *i_reiserfs;
48 
49 	uint32_t	 i_flag;              /* Flags, see below */
50 	uint32_t	 i_key[4];            /* Key is still 4 32 bit
51 						 integers */
52 	uint32_t	 i_flags;             /* Transient inode flags that
53 						 are never stored on disk.
54 						 Bitmasks for this field
55 						 are defined above. */
56 	uint32_t	 i_first_direct_byte; /* Offset of first byte stored
57 						 in direct item. */
58 	uint32_t	 i_attrs;             /* Copy of persistent inode
59 						 flags read from sd_attrs. */
60 
61 	uint16_t	 i_mode;              /* IFMT, permissions. */
62 	int16_t		 i_nlink;             /* File link count. */
63 	uint64_t	 i_size;              /* File byte count. */
64 	uint32_t	 i_bytes;
65 	uid_t		 i_uid;               /* File owner. */
66 	gid_t		 i_gid;               /* File group. */
67 	struct timespec	 i_atime;             /* Last access time. */
68 	struct timespec	 i_mtime;             /* Last modified time. */
69 	struct timespec	 i_ctime;             /* Last inode change time. */
70 
71 	uint32_t	 i_blocks;
72 	uint32_t	 i_generation;
73 };
74 
75 #define	VTOI(vp)	((struct reiserfs_node *)(vp)->v_data)
76 #define	ITOV(ip)	((ip)->i_vnode)
77 
78 /* These flags are kept in i_flag. */
79 #define	IN_HASHED	0x0020 /* Inode is on hash list */
80 
81 /* This overlays the fid structure (see mount.h) */
82 struct rfid {
83 	uint16_t	rfid_len;   /* Length of structure */
84 	uint16_t	rfid_pad;   /* Force 32-bit alignment */
85 	ino_t		rfid_dirid; /* File key */
86 	ino_t		rfid_objectid;
87 	uint32_t	rfid_gen;   /* Generation number */
88 };
89 
90 #endif /* !defined _GNU_REISERFS_REISERFS_FS_I_H */
91