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