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