Home | History | Annotate | Line # | Download | only in ntfs
ntfs_inode.h revision 1.9.56.1
      1  1.9.56.1  perseant /*	$NetBSD: ntfs_inode.h,v 1.9.56.1 2025/08/02 05:57:39 perseant Exp $	*/
      2       1.1  jdolecek 
      3       1.1  jdolecek /*-
      4       1.1  jdolecek  * Copyright (c) 1998, 1999 Semen Ustimenko
      5       1.1  jdolecek  * All rights reserved.
      6       1.1  jdolecek  *
      7       1.1  jdolecek  * Redistribution and use in source and binary forms, with or without
      8       1.1  jdolecek  * modification, are permitted provided that the following conditions
      9       1.1  jdolecek  * are met:
     10       1.1  jdolecek  * 1. Redistributions of source code must retain the above copyright
     11       1.1  jdolecek  *    notice, this list of conditions and the following disclaimer.
     12       1.1  jdolecek  * 2. Redistributions in binary form must reproduce the above copyright
     13       1.1  jdolecek  *    notice, this list of conditions and the following disclaimer in the
     14       1.1  jdolecek  *    documentation and/or other materials provided with the distribution.
     15       1.1  jdolecek  *
     16       1.1  jdolecek  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
     17       1.1  jdolecek  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     18       1.1  jdolecek  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     19       1.1  jdolecek  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
     20       1.1  jdolecek  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     21       1.1  jdolecek  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     22       1.1  jdolecek  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     23       1.1  jdolecek  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     24       1.1  jdolecek  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25       1.1  jdolecek  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26       1.1  jdolecek  * SUCH DAMAGE.
     27       1.1  jdolecek  *
     28       1.1  jdolecek  *	Id: ntfs_inode.h,v 1.4 1999/05/12 09:43:00 semenu Exp
     29       1.1  jdolecek  */
     30       1.1  jdolecek 
     31       1.3  christos #ifndef _NTFS_NTFS_INODE_H_
     32       1.3  christos #define _NTFS_NTFS_INODE_H_
     33       1.1  jdolecek #include <miscfs/genfs/genfs_node.h>
     34       1.1  jdolecek 
     35       1.1  jdolecek /* These flags are kept in i_flag. */
     36       1.1  jdolecek #define	IN_ACCESS	0x0001	/* Access time update request. */
     37       1.1  jdolecek #define	IN_CHANGE	0x0002	/* Inode change time update request. */
     38       1.1  jdolecek #define	IN_EXLOCK	0x0004	/* File has exclusive lock. */
     39       1.1  jdolecek #define	IN_LOCKED	0x0008	/* Inode lock. */
     40       1.1  jdolecek #define	IN_LWAIT	0x0010	/* Process waiting on file lock. */
     41       1.1  jdolecek #define	IN_MODIFIED	0x0020	/* Inode has been modified. */
     42       1.1  jdolecek #define	IN_RENAME	0x0040	/* Inode is being renamed. */
     43       1.1  jdolecek #define	IN_SHLOCK	0x0080	/* File has shared lock. */
     44       1.1  jdolecek #define	IN_UPDATE	0x0100	/* Modification time update request. */
     45       1.1  jdolecek #define	IN_WANTED	0x0200	/* Inode is wanted by a process. */
     46       1.1  jdolecek #define	IN_RECURSE	0x0400	/* Recursion expected */
     47       1.1  jdolecek 
     48       1.1  jdolecek #define	IN_HASHED	0x0800	/* Inode is on hash list */
     49       1.1  jdolecek #define	IN_LOADED	0x8000	/* ntvattrs loaded */
     50       1.1  jdolecek #define	IN_PRELOADED	0x4000	/* loaded from directory entry */
     51       1.1  jdolecek 
     52       1.1  jdolecek struct ntnode {
     53       1.1  jdolecek 	struct vnode   *i_devvp;	/* vnode of blk dev we live on */
     54       1.1  jdolecek 	dev_t           i_dev;		/* Device associated with the inode. */
     55       1.1  jdolecek 
     56       1.1  jdolecek 	LIST_ENTRY(ntnode)	i_hash;
     57       1.1  jdolecek 	struct ntfsmount       *i_mp;
     58       1.1  jdolecek 	ino_t           i_number;
     59       1.1  jdolecek 	u_int32_t       i_flag;
     60       1.1  jdolecek 
     61       1.1  jdolecek 	/* locking */
     62       1.6        ad 	kcondvar_t	i_lock;
     63       1.5        ad 	kmutex_t	i_interlock;
     64       1.1  jdolecek 	int		i_usecount;
     65       1.6        ad 	int		i_busy;
     66       1.1  jdolecek 
     67       1.1  jdolecek 	LIST_HEAD(,ntvattr)	i_valist;
     68       1.1  jdolecek 
     69       1.1  jdolecek 	long		i_nlink;	/* MFR */
     70       1.1  jdolecek 	ino_t		i_mainrec;	/* MFR */
     71       1.1  jdolecek 	u_int32_t	i_frflag;	/* MFR */
     72       1.1  jdolecek };
     73       1.1  jdolecek 
     74       1.9   hannken #define NTKEY_SIZE(attrlen) (sizeof(struct ntkey) + (attrlen))
     75       1.9   hannken struct ntkey {
     76       1.9   hannken 	ino_t		k_ino;		/* Inode number of ntnode. */
     77       1.9   hannken 	u_int32_t	k_attrtype;	/* Attribute type. */
     78       1.9   hannken 	char		k_attrname[1];	/* Attribute name (variable length). */
     79       1.9   hannken } __packed;
     80       1.9   hannken 
     81       1.1  jdolecek struct fnode {
     82       1.1  jdolecek 	struct genfs_node f_gnode;
     83       1.2     perry 
     84       1.1  jdolecek 	LIST_ENTRY(fnode) f_fnlist;
     85  1.9.56.1  perseant 	struct vnode   *f_vp;		/* Associated vnode */
     86       1.1  jdolecek 	struct ntnode  *f_ip;		/* Associated ntnode */
     87       1.1  jdolecek 
     88       1.1  jdolecek 	ntfs_times_t	f_times;	/* $NAME/dirinfo */
     89       1.1  jdolecek 	ino_t		f_pnumber;	/* $NAME/dirinfo */
     90       1.1  jdolecek 	u_int32_t       f_fflag;	/* $NAME/dirinfo */
     91       1.1  jdolecek 	u_int64_t	f_size;		/* defattr/dirinfo: */
     92       1.1  jdolecek 	u_int64_t	f_allocated;	/* defattr/dirinfo */
     93       1.1  jdolecek 
     94       1.9   hannken 	struct ntkey   *f_key;
     95       1.9   hannken 	struct ntkey	f_smallkey;
     96       1.9   hannken #define f_ino f_key->k_ino
     97       1.9   hannken #define f_attrtype f_key->k_attrtype
     98       1.9   hannken #define f_attrname f_key->k_attrname
     99       1.1  jdolecek 
    100       1.1  jdolecek 	/* for ntreaddir */
    101       1.1  jdolecek 	u_int32_t       f_lastdattr;
    102       1.1  jdolecek 	u_int32_t       f_lastdblnum;
    103       1.1  jdolecek 	u_int32_t       f_lastdoff;
    104       1.1  jdolecek 	u_int32_t       f_lastdnum;
    105       1.4  christos 	void *        f_dirblbuf;
    106       1.1  jdolecek 	u_int32_t       f_dirblsz;
    107       1.1  jdolecek };
    108       1.1  jdolecek 
    109       1.1  jdolecek /* This overlays the fid structure (see <sys/mount.h>) */
    110       1.1  jdolecek struct ntfid {
    111       1.1  jdolecek 	u_int16_t ntfid_len;	/* Length of structure. */
    112       1.1  jdolecek 	u_int16_t ntfid_pad;	/* Force 32-bit alignment. */
    113       1.1  jdolecek 	ino_t     ntfid_ino;	/* File number (ino). */
    114       1.1  jdolecek 	u_int8_t  ntfid_attr;	/* Attribute identifier */
    115       1.1  jdolecek #ifdef notyet
    116       1.1  jdolecek 	int32_t   ntfid_gen;	/* Generation number. */
    117       1.1  jdolecek #endif
    118       1.1  jdolecek };
    119       1.3  christos #endif /* _NTFS_NTFS_INODE_H_ */
    120