154095Ssemenu/*	$NetBSD: ntfs_inode.h,v 1.8 1999/10/31 19:45:26 jdolecek Exp $	*/
247060Ssemenu
343552Ssemenu/*-
443552Ssemenu * Copyright (c) 1998, 1999 Semen Ustimenko
543552Ssemenu * All rights reserved.
643552Ssemenu *
743552Ssemenu * Redistribution and use in source and binary forms, with or without
843552Ssemenu * modification, are permitted provided that the following conditions
943552Ssemenu * are met:
1043552Ssemenu * 1. Redistributions of source code must retain the above copyright
1143552Ssemenu *    notice, this list of conditions and the following disclaimer.
1243552Ssemenu * 2. Redistributions in binary form must reproduce the above copyright
1343552Ssemenu *    notice, this list of conditions and the following disclaimer in the
1443552Ssemenu *    documentation and/or other materials provided with the distribution.
1543552Ssemenu *
1643552Ssemenu * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1743552Ssemenu * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1843552Ssemenu * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1943552Ssemenu * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2043552Ssemenu * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2143552Ssemenu * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2243552Ssemenu * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2343552Ssemenu * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2443552Ssemenu * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2543552Ssemenu * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2643552Ssemenu * SUCH DAMAGE.
2743552Ssemenu *
2850477Speter * $FreeBSD$
2943552Ssemenu */
3043552Ssemenu
3143552Ssemenu/* These flags are kept in i_flag. */
3243552Ssemenu#define	IN_ACCESS	0x0001	/* Access time update request. */
3343552Ssemenu#define	IN_CHANGE	0x0002	/* Inode change time update request. */
3443552Ssemenu#define	IN_UPDATE	0x0004	/* Modification time update request. */
3543552Ssemenu#define	IN_MODIFIED	0x0008	/* Inode has been modified. */
3643552Ssemenu#define	IN_RENAME	0x0010	/* Inode is being renamed. */
3743552Ssemenu#define	IN_SHLOCK	0x0020	/* File has shared lock. */
3843552Ssemenu#define	IN_EXLOCK	0x0040	/* File has exclusive lock. */
3947060Ssemenu#define	IN_LAZYMOD	0x0080	/* Modified, but don't write yet. */
4047060Ssemenu#define	IN_HASHED	0x0800	/* Inode is on hash list */
4143552Ssemenu#define	IN_LOADED	0x8000	/* ntvattrs loaded */
4243552Ssemenu#define	IN_PRELOADED	0x4000	/* loaded from directory entry */
4343552Ssemenu
4443552Ssemenustruct ntnode {
4554095Ssemenu	struct vnode   *i_devvp;	/* vnode of blk dev we live on */
46130585Sphk	struct cdev *i_dev;		/* Device associated with the inode. */
4754095Ssemenu
4860938Sjake	LIST_ENTRY(ntnode)	i_hash;
4943552Ssemenu	struct ntnode  *i_next;
5043552Ssemenu	struct ntnode **i_prev;
5145879Ssemenu	struct ntfsmount       *i_mp;
5244142Ssemenu	ino_t           i_number;
5343552Ssemenu	u_int32_t       i_flag;
5454095Ssemenu
5554095Ssemenu	/* locking */
5654095Ssemenu	struct lock	i_lock;
5766615Sjasone	struct mtx	i_interlock;
5844142Ssemenu	int		i_usecount;
5954095Ssemenu
6060938Sjake	LIST_HEAD(,fnode)	i_fnlist;
6160938Sjake	LIST_HEAD(,ntvattr)	i_valist;
6244142Ssemenu
6343552Ssemenu	long		i_nlink;	/* MFR */
6443552Ssemenu	ino_t		i_mainrec;	/* MFR */
6543552Ssemenu	u_int32_t	i_frflag;	/* MFR */
6644142Ssemenu};
6743552Ssemenu
6844142Ssemenu#define	FN_PRELOADED	0x0001
6945879Ssemenu#define	FN_VALID	0x0002
7044142Ssemenu#define	FN_AATTRNAME	0x0004	/* space allocated for f_attrname */
7144142Ssemenustruct fnode {
7260938Sjake	LIST_ENTRY(fnode) f_fnlist;
7344142Ssemenu	struct vnode   *f_vp;		/* Associatied vnode */
7454095Ssemenu	struct ntnode  *f_ip;		/* Associated ntnode */
7544142Ssemenu	u_long		f_flag;
7643552Ssemenu
7744142Ssemenu	ntfs_times_t	f_times;	/* $NAME/dirinfo */
7844142Ssemenu	ino_t		f_pnumber;	/* $NAME/dirinfo */
7944142Ssemenu	u_int32_t       f_fflag;	/* $NAME/dirinfo */
8044142Ssemenu	u_int64_t	f_size;		/* defattr/dirinfo: */
8144142Ssemenu	u_int64_t	f_allocated;	/* defattr/dirinfo */
8244142Ssemenu
8344142Ssemenu	u_int32_t	f_attrtype;
8444142Ssemenu	char	       *f_attrname;
8544142Ssemenu
8644142Ssemenu	/* for ntreaddir */
8744142Ssemenu	u_int32_t       f_lastdattr;
8844142Ssemenu	u_int32_t       f_lastdblnum;
8944142Ssemenu	u_int32_t       f_lastdoff;
9044142Ssemenu	u_int32_t       f_lastdnum;
9144142Ssemenu	caddr_t         f_dirblbuf;
9244142Ssemenu	u_int32_t       f_dirblsz;
9343552Ssemenu};
9454095Ssemenu
9554095Ssemenu/* This overlays the fid structure (see <sys/mount.h>) */
9654095Ssemenustruct ntfid {
9754095Ssemenu        u_int16_t ntfid_len;     /* Length of structure. */
9854095Ssemenu        u_int16_t ntfid_pad;     /* Force 32-bit alignment. */
9954095Ssemenu        ino_t     ntfid_ino;     /* File number (ino). */
10054095Ssemenu        int32_t   ntfid_gen;     /* Generation number. */
10154095Ssemenu};
102