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