efs_inode.h revision 1.1.2.2 1 1.1.2.2 ad /* $NetBSD: efs_inode.h,v 1.1.2.2 2007/07/15 16:15:27 ad Exp $ */
2 1.1.2.2 ad
3 1.1.2.2 ad /*
4 1.1.2.2 ad * Copyright (c) 2006 Stephen M. Rumble <rumble (at) ephemeral.org>
5 1.1.2.2 ad *
6 1.1.2.2 ad * Permission to use, copy, modify, and distribute this software for any
7 1.1.2.2 ad * purpose with or without fee is hereby granted, provided that the above
8 1.1.2.2 ad * copyright notice and this permission notice appear in all copies.
9 1.1.2.2 ad *
10 1.1.2.2 ad * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 1.1.2.2 ad * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 1.1.2.2 ad * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 1.1.2.2 ad * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 1.1.2.2 ad * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 1.1.2.2 ad * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 1.1.2.2 ad * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 1.1.2.2 ad */
18 1.1.2.2 ad
19 1.1.2.2 ad #ifndef _FS_EFS_EFS_INODE_H_
20 1.1.2.2 ad #define _FS_EFS_EFS_INODE_H_
21 1.1.2.2 ad
22 1.1.2.2 ad #include <fs/efs/efs_subr.h>
23 1.1.2.2 ad
24 1.1.2.2 ad /*
25 1.1.2.2 ad * The efs_inode structure represents an in-core inode. It contains meta-data
26 1.1.2.2 ad * corresponding directly to the efs_dinode structure in host byte order and
27 1.1.2.2 ad * with native NetBSD flags and fields, a copy of the on-disk dinode structure,
28 1.1.2.2 ad * as well as other bookkeeping information.
29 1.1.2.2 ad */
30 1.1.2.2 ad struct efs_inode {
31 1.1.2.2 ad struct genfs_node ei_gnode;
32 1.1.2.2 ad struct lockf *ei_lockf; /* advisory lock */
33 1.1.2.2 ad ino_t ei_number; /* inode number */
34 1.1.2.2 ad dev_t ei_dev; /* associated device */
35 1.1.2.2 ad struct vnode *ei_vp; /* associated vnode */
36 1.1.2.2 ad LIST_ENTRY(efs_inode) ei_hash; /* inode hash chain */
37 1.1.2.2 ad
38 1.1.2.2 ad /*
39 1.1.2.2 ad * Host-ordered on-disk fields with native NetBSD types and flags.
40 1.1.2.2 ad */
41 1.1.2.2 ad uint16_t ei_mode; /* file type and permissions */
42 1.1.2.2 ad int16_t ei_nlink; /* link count (minimum 2) */
43 1.1.2.2 ad uid_t ei_uid; /* user ID */
44 1.1.2.2 ad gid_t ei_gid; /* group ID */
45 1.1.2.2 ad int32_t ei_size; /* file size (in bytes) */
46 1.1.2.2 ad time_t ei_atime; /* file access time */
47 1.1.2.2 ad time_t ei_mtime; /* file modification time */
48 1.1.2.2 ad time_t ei_ctime; /* inode modification time */
49 1.1.2.2 ad int32_t ei_gen; /* inode generation number */
50 1.1.2.2 ad int16_t ei_numextents; /* number of extents in file */
51 1.1.2.2 ad uint8_t ei_version; /* inode version */
52 1.1.2.2 ad
53 1.1.2.2 ad /*
54 1.1.2.2 ad * Copy of the on-disk inode structure, in EFS native format and
55 1.1.2.2 ad * endianness.
56 1.1.2.2 ad */
57 1.1.2.2 ad struct efs_dinode ei_di;
58 1.1.2.2 ad };
59 1.1.2.2 ad
60 1.1.2.2 ad #define EFS_VTOI(vp) ((struct efs_inode *)(vp)->v_data)
61 1.1.2.2 ad #define EFS_ITOV(eip) ((struct vnode *)(eip)->ei_vp)
62 1.1.2.2 ad
63 1.1.2.2 ad /*
64 1.1.2.2 ad * File handle. The first two fields must match struct fid (see sys/fstypes.h).
65 1.1.2.2 ad */
66 1.1.2.2 ad struct efs_fid {
67 1.1.2.2 ad unsigned short ef_len; /* length of data in bytes */
68 1.1.2.2 ad unsigned short ef_pad; /* compat: historic align */
69 1.1.2.2 ad int32_t ef_ino; /* inode number */
70 1.1.2.2 ad int32_t ef_gen; /* inode generation number */
71 1.1.2.2 ad };
72 1.1.2.2 ad
73 1.1.2.2 ad #endif /* !_FS_EFS_EFS_INODE_H_ */
74