1139776Simp/*-
2206361Sjoel * Copyright (c) 2000-2001 Boris Popov
375374Sbp * All rights reserved.
475374Sbp *
575374Sbp * Redistribution and use in source and binary forms, with or without
675374Sbp * modification, are permitted provided that the following conditions
775374Sbp * are met:
875374Sbp * 1. Redistributions of source code must retain the above copyright
975374Sbp *    notice, this list of conditions and the following disclaimer.
1075374Sbp * 2. Redistributions in binary form must reproduce the above copyright
1175374Sbp *    notice, this list of conditions and the following disclaimer in the
1275374Sbp *    documentation and/or other materials provided with the distribution.
1375374Sbp *
1475374Sbp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1575374Sbp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1675374Sbp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1775374Sbp * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1875374Sbp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1975374Sbp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2075374Sbp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2175374Sbp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2275374Sbp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2375374Sbp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2475374Sbp * SUCH DAMAGE.
2575374Sbp *
2675374Sbp * $FreeBSD$
2775374Sbp */
2875374Sbp#ifndef _FS_SMBFS_NODE_H_
2975374Sbp#define _FS_SMBFS_NODE_H_
3075374Sbp
3175374Sbp#define	SMBFS_ROOT_INO		2	/* just like in UFS */
3275374Sbp
3375374Sbp/* Bits for smbnode.n_flag */
3475374Sbp#define	NFLUSHINPROG		0x0001
3575374Sbp#define	NFLUSHWANT		0x0002	/* they should gone ... */
3675374Sbp#define	NMODIFIED		0x0004	/* bogus, until async IO implemented */
3775374Sbp/*efine	NNEW			0x0008*//* smb/vnode has been allocated */
3875374Sbp#define	NREFPARENT		0x0010	/* node holds parent from recycling */
39103533Sbp#define	NFLUSHWIRE		0x1000	/* pending flush request */
40116486Stjr#define	NOPEN			0x2000	/* file is open */
41125637Stjr#define	NGONE			0x4000	/* file has been removed/renamed */
4275374Sbp
4375374Sbpstruct smbfs_fctx;
4475374Sbp
4575374Sbpstruct smbnode {
4675374Sbp	int			n_flag;
47107821Stjr	struct vnode *		n_parent;
4875374Sbp	struct vnode *		n_vnode;
4975374Sbp	struct smbmount *	n_mount;
5075374Sbp	time_t			n_attrage;	/* attributes cache time */
5175374Sbp/*	time_t			n_ctime;*/
5275374Sbp	struct timespec		n_mtime;	/* modify time */
5375374Sbp	struct timespec		n_atime;	/* last access time */
5475374Sbp	u_quad_t		n_size;
5575374Sbp	long			n_ino;
5675374Sbp	int			n_dosattr;
5775374Sbp	u_int16_t		n_fid;		/* file handle */
5875374Sbp	int			n_rwstate;	/* granted access mode */
5975374Sbp	u_char			n_nmlen;
6075374Sbp	u_char *		n_name;
6175374Sbp	struct smbfs_fctx *	n_dirseq;	/* ff context */
6275374Sbp	long			n_dirofs;	/* last ff offset */
6375374Sbp	LIST_ENTRY(smbnode)	n_hash;
6475374Sbp};
6575374Sbp
6675374Sbp#define VTOSMB(vp)	((struct smbnode *)(vp)->v_data)
6775374Sbp#define SMBTOV(np)	((struct vnode *)(np)->n_vnode)
6875374Sbp
6975374Sbpstruct vop_getpages_args;
7075374Sbpstruct vop_inactive_args;
7175374Sbpstruct vop_putpages_args;
7275374Sbpstruct vop_reclaim_args;
7375374Sbpstruct ucred;
7475374Sbpstruct uio;
7575374Sbpstruct smbfattr;
7675374Sbp
7775374Sbpint  smbfs_inactive(struct vop_inactive_args *);
7875374Sbpint  smbfs_reclaim(struct vop_reclaim_args *);
7975374Sbpint smbfs_nget(struct mount *mp, struct vnode *dvp, const char *name, int nmlen,
8075374Sbp	struct smbfattr *fap, struct vnode **vpp);
8175374Sbpu_int32_t smbfs_hash(const u_char *name, int nmlen);
8275374Sbp
8375374Sbpint  smbfs_getpages(struct vop_getpages_args *);
8475374Sbpint  smbfs_putpages(struct vop_putpages_args *);
8575374Sbpint  smbfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred);
8675374Sbpint  smbfs_writevnode(struct vnode *vp, struct uio *uiop, struct ucred *cred, int ioflag);
8775374Sbpvoid smbfs_attr_cacheenter(struct vnode *vp, struct smbfattr *fap);
8875374Sbpint  smbfs_attr_cachelookup(struct vnode *vp ,struct vattr *va);
8975374Sbp
9075374Sbp#define smbfs_attr_cacheremove(vp)	VTOSMB(vp)->n_attrage = 0
9175374Sbp
9275374Sbp#endif /* _FS_SMBFS_NODE_H_ */
93