ntfs_inode.h revision 60938
1260684Skaiw/*	$NetBSD: ntfs_inode.h,v 1.8 1999/10/31 19:45:26 jdolecek Exp $	*/
2260684Skaiw
3260684Skaiw/*-
4260684Skaiw * Copyright (c) 1998, 1999 Semen Ustimenko
5260684Skaiw * All rights reserved.
6260684Skaiw *
7260684Skaiw * Redistribution and use in source and binary forms, with or without
8260684Skaiw * modification, are permitted provided that the following conditions
9260684Skaiw * are met:
10260684Skaiw * 1. Redistributions of source code must retain the above copyright
11260684Skaiw *    notice, this list of conditions and the following disclaimer.
12260684Skaiw * 2. Redistributions in binary form must reproduce the above copyright
13260684Skaiw *    notice, this list of conditions and the following disclaimer in the
14260684Skaiw *    documentation and/or other materials provided with the distribution.
15260684Skaiw *
16260684Skaiw * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17260684Skaiw * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18260684Skaiw * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19260684Skaiw * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20260684Skaiw * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21260684Skaiw * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22260684Skaiw * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23260684Skaiw * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24260684Skaiw * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25260684Skaiw * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26260684Skaiw * SUCH DAMAGE.
27260684Skaiw *
28260684Skaiw * $FreeBSD: head/sys/fs/ntfs/ntfs_inode.h 60938 2000-05-26 02:09:24Z jake $
29276398Semaste */
30260684Skaiw
31260684Skaiw/* These flags are kept in i_flag. */
32260684Skaiw#if defined(__FreeBSD__)
33260684Skaiw#define	IN_ACCESS	0x0001	/* Access time update request. */
34260684Skaiw#define	IN_CHANGE	0x0002	/* Inode change time update request. */
35260684Skaiw#define	IN_UPDATE	0x0004	/* Modification time update request. */
36260684Skaiw#define	IN_MODIFIED	0x0008	/* Inode has been modified. */
37260684Skaiw#define	IN_RENAME	0x0010	/* Inode is being renamed. */
38260684Skaiw#define	IN_SHLOCK	0x0020	/* File has shared lock. */
39260684Skaiw#define	IN_EXLOCK	0x0040	/* File has exclusive lock. */
40260684Skaiw#define	IN_LAZYMOD	0x0080	/* Modified, but don't write yet. */
41260684Skaiw#else /* defined(__NetBSD__) */
42260684Skaiw#define	IN_ACCESS	0x0001	/* Access time update request. */
43260684Skaiw#define	IN_CHANGE	0x0002	/* Inode change time update request. */
44260684Skaiw#define	IN_EXLOCK	0x0004	/* File has exclusive lock. */
45260684Skaiw#define	IN_LOCKED	0x0008	/* Inode lock. */
46260684Skaiw#define	IN_LWAIT	0x0010	/* Process waiting on file lock. */
47260684Skaiw#define	IN_MODIFIED	0x0020	/* Inode has been modified. */
48260684Skaiw#define	IN_RENAME	0x0040	/* Inode is being renamed. */
49260684Skaiw#define	IN_SHLOCK	0x0080	/* File has shared lock. */
50260684Skaiw#define	IN_UPDATE	0x0100	/* Modification time update request. */
51260684Skaiw#define	IN_WANTED	0x0200	/* Inode is wanted by a process. */
52260684Skaiw#define	IN_RECURSE	0x0400	/* Recursion expected */
53260684Skaiw#endif
54260684Skaiw
55260684Skaiw#define	IN_HASHED	0x0800	/* Inode is on hash list */
56260684Skaiw#define	IN_LOADED	0x8000	/* ntvattrs loaded */
57260684Skaiw#define	IN_PRELOADED	0x4000	/* loaded from directory entry */
58260684Skaiw
59260684Skaiwstruct ntnode {
60260684Skaiw	struct vnode   *i_devvp;	/* vnode of blk dev we live on */
61260684Skaiw	dev_t           i_dev;		/* Device associated with the inode. */
62260684Skaiw
63260684Skaiw	LIST_ENTRY(ntnode)	i_hash;
64260684Skaiw	struct ntnode  *i_next;
65260684Skaiw	struct ntnode **i_prev;
66260684Skaiw	struct ntfsmount       *i_mp;
67260684Skaiw	ino_t           i_number;
68260684Skaiw	u_int32_t       i_flag;
69260684Skaiw
70260684Skaiw	/* locking */
71260684Skaiw	struct lock	i_lock;
72276371Semaste	struct simplelock i_interlock;
73276371Semaste	int		i_usecount;
74260684Skaiw
75260684Skaiw	LIST_HEAD(,fnode)	i_fnlist;
76260684Skaiw	LIST_HEAD(,ntvattr)	i_valist;
77260684Skaiw
78260684Skaiw	long		i_nlink;	/* MFR */
79260684Skaiw	ino_t		i_mainrec;	/* MFR */
80260684Skaiw	u_int32_t	i_frflag;	/* MFR */
81260684Skaiw};
82260684Skaiw
83260684Skaiw#define	FN_PRELOADED	0x0001
84260684Skaiw#define	FN_VALID	0x0002
85260684Skaiw#define	FN_AATTRNAME	0x0004	/* space allocated for f_attrname */
86260684Skaiwstruct fnode {
87260684Skaiw#ifdef __FreeBSD__
88260684Skaiw	struct lock	f_lock;	/* fnode lock >Keep this first< */
89260684Skaiw#endif
90260684Skaiw
91260684Skaiw	LIST_ENTRY(fnode) f_fnlist;
92260684Skaiw	struct vnode   *f_vp;		/* Associatied vnode */
93260684Skaiw	struct ntnode  *f_ip;		/* Associated ntnode */
94276371Semaste	u_long		f_flag;
95260684Skaiw
96276398Semaste	ntfs_times_t	f_times;	/* $NAME/dirinfo */
97260684Skaiw	ino_t		f_pnumber;	/* $NAME/dirinfo */
98276371Semaste	u_int32_t       f_fflag;	/* $NAME/dirinfo */
99276371Semaste	u_int64_t	f_size;		/* defattr/dirinfo: */
100276371Semaste	u_int64_t	f_allocated;	/* defattr/dirinfo */
101260684Skaiw
102260684Skaiw	u_int32_t	f_attrtype;
103260684Skaiw	char	       *f_attrname;
104260684Skaiw
105260684Skaiw	/* for ntreaddir */
106260684Skaiw	u_int32_t       f_lastdattr;
107260684Skaiw	u_int32_t       f_lastdblnum;
108260684Skaiw	u_int32_t       f_lastdoff;
109260684Skaiw	u_int32_t       f_lastdnum;
110260684Skaiw	caddr_t         f_dirblbuf;
111260684Skaiw	u_int32_t       f_dirblsz;
112260684Skaiw};
113260684Skaiw
114260684Skaiw/* This overlays the fid structure (see <sys/mount.h>) */
115260684Skaiwstruct ntfid {
116260684Skaiw        u_int16_t ntfid_len;     /* Length of structure. */
117260684Skaiw        u_int16_t ntfid_pad;     /* Force 32-bit alignment. */
118260684Skaiw        ino_t     ntfid_ino;     /* File number (ino). */
119260684Skaiw        int32_t   ntfid_gen;     /* Generation number. */
120260684Skaiw};
121260684Skaiw