/*********************** directories ***********************/
/*
* This is the on-disk directory entry. For now, d_type can
* be supported by just clearing the high bits.
*/
struct ufs_direct {
__u32 d_ino; /* inode number of this entry */
__u16 d_reclen; /* length of this entry */
union { struct {
__u16 d_namlen; /* actual length of d_name */
} older; struct {
__u8 d_type; /* somewhat like top 4 mode bits */
__u8 d_namlen; /* actual length of d_name */
} newer; } os_u;
char d_name[UFS_MAXNAMLEN + 1]; /* file name */
/* Digital Unix may add __u32 sensitivity and info labels here */
};
#define d_namlen os_u.older.d_namlen
/* For the type code, same as mode>>12 */
/* Note SunOS defines an extra ACL inode type that might conflict. */
#define DT_UNKNOWN 0
#define DT_FIFO 1
#define DT_CHR 2
#define DT_DIR 4
#define DT_BLK 6
#define DT_REG 8
#define DT_LNK 10
#define DT_SOCK 12
#define DT_WHT 14 /* NetBSD and OpenBSD only. */
/*
* There is a "Whiteout inode #" used in a whited out directory entry.
* DT_WHT, WINO, and S_IFWHT all go together. NetBSD and OpenBSD only.
*/
/* #define WINO ((ino_t)1) */
/* #define S_IFWHT 0160000 */
/********************** inodes ************************/
/* These flags apply to FreeBSD, OpenBSD, and NetBSD inodes. */
/* Linux does not let users have their own immutable flag, etc. */
#define UFS_F_ROOT_FLAGS 0xffff0000 /* only root can change */
#define UFS_F_USER_FLAGS 0x0000ffff /* owner and root can change */
#define UFS_F_NODUMP_FL 0x00010001 /* do not dump file */
#define UFS_F_IMMUTABLE_FL 0x00020000 /* immutable file */
#define UFS_F_APPEND_FL 0x00040000 /* append-only file */
/* Digital Unix flags -- but they are "currently unused"? */
#define UFS_D_FASTLINK 0x00000001 /* Symbolic link in inode */
#define UFS_D_PROPLIST_FRAG 0x00000002
#define UFS_D_PROPLIST_BLOCK 0x00000004
#define UFS_D_PROPLIST 0x00000006 /* Property list exists */
/*
* Structure of an on-disk inode, variations of which include:
*
* Sun uses a special file mode for inodes that store ACL info.
*
* Digital Unix tacks 70 bytes on the end if security extensions in use.
*
* Ultrix has 4 reserved __u32 at the end.
* Uses microseconds, not nanoseconds. (struct timeval)
*/
struct ufs_inode {
__u16 i_mode; /* IFMT and permissions */
__u16 i_links_count; /* link count */
union { struct {
__u16 i_uid_16; /* FFS: old user ID */
__u16 i_gid_16; /* FFS: old group ID */
} ffs; struct {
__u32 i_inode; /* LFS: inode number */
} lfs; } fs_u;
__u64 i_size; /* size in bytes */
struct timespec i_atime; /* access time */
struct timespec i_mtime; /* modification time */
struct timespec i_ctime; /* inode change time */
__u32 i_db[NDADDR]; /* direct disk blocks */
__u32 i_ib[NIADDR]; /* indirect disk blocks */
__u32 i_flags; /* file flags */
__u32 i_blocks; /* blocks count */
__u32 i_version; /* file version (for NFS) */
/* Can't use anything below here without knowing the UFS variety. */
union { struct {
__u32 s_i_shadow; /* shadow inode, for ACLs? */
__u32 s_i_uid; /* file owner */
__u32 s_i_gid; /* file group */
__u32 s_i_oeftflag; /* reserved (or secret) */
} sun; struct {
__u32 p_i_spare[4]; /* reserved */
} plain; /* Ultrix */ struct {
__u32 f_i_uid; /* file owner */
__u32 f_i_gid; /* file group */
__u32 f_i_spare[2]; /* reserved */
} bsd; /* freebsd, netbsd, and openbsd */ struct {
__u32 d_i_property_list;
__u32 d_i_spare[3]; /* reserved */
#ifdef UFS_EXTENDED_INODE /* This is Digital Unix security data. */
__u64 i_granted_priv[2];
__u64 i_potential_priv[2];
__u32 i_policy_tag[8];
__u32 i_mld_child_parent_inode;
__u16 i_type_flags;
/* char[128-70] padding perhaps? */
#endif
} digital; } os_u;
};
#define i_reserved os_u.plain.p_i_spare
#define i_uid fs_u.ffs.i_uid_16
#define i_gid fs_u.ffs.i_gid_16