/*-1* SPDX-License-Identifier: BSD-2-Clause2*3* Copyright (c) 2000-2001 Boris Popov4* All rights reserved.5*6* Redistribution and use in source and binary forms, with or without7* modification, are permitted provided that the following conditions8* are met:9* 1. Redistributions of source code must retain the above copyright10* notice, this list of conditions and the following disclaimer.11* 2. Redistributions in binary form must reproduce the above copyright12* notice, this list of conditions and the following disclaimer in the13* documentation and/or other materials provided with the distribution.14*15* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND16* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE17* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE18* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE19* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL20* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS21* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)22* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT23* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY24* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF25* SUCH DAMAGE.26*/27#ifndef _FS_SMBFS_NODE_H_28#define _FS_SMBFS_NODE_H_2930#define SMBFS_ROOT_INO 2 /* just like in UFS */3132/* Bits for smbnode.n_flag */33#define NFLUSHINPROG 0x000134#define NFLUSHWANT 0x0002 /* they should gone ... */35#define NMODIFIED 0x0004 /* bogus, until async IO implemented */36/*efine NNEW 0x0008*//* smb/vnode has been allocated */37#define NREFPARENT 0x0010 /* node holds parent from recycling */38#define NFLUSHWIRE 0x1000 /* pending flush request */39#define NOPEN 0x2000 /* file is open */40#define NGONE 0x4000 /* file has been removed/renamed */4142struct smbfs_fctx;4344struct smbnode {45int n_flag;46struct vnode * n_parent;47struct vnode * n_vnode;48struct smbmount * n_mount;49time_t n_attrage; /* attributes cache time */50/* time_t n_ctime;*/51struct timespec n_mtime; /* modify time */52struct timespec n_atime; /* last access time */53u_quad_t n_size;54long n_ino;55long n_parentino; /* parent inode number */56int n_dosattr;57u_int16_t n_fid; /* file handle */58int n_rwstate; /* granted access mode */59int n_rplen;60char * n_rpath;61u_char n_nmlen;62u_char * n_name;63struct smbfs_fctx * n_dirseq; /* ff context */64long n_dirofs; /* last ff offset */65LIST_ENTRY(smbnode) n_hash;66};6768struct smbcmp {69struct vnode * n_parent;70int n_nmlen;71const char * n_name;72};7374#define VTOSMB(vp) ((struct smbnode *)(vp)->v_data)75#define SMBTOV(np) ((struct vnode *)(np)->n_vnode)7677#define SMBFS_DNP_SEP(dnp) ((dnp->n_rplen > 1) ? '\\' : '\0')7879struct vop_getpages_args;80struct vop_inactive_args;81struct vop_putpages_args;82struct vop_reclaim_args;83struct ucred;84struct uio;85struct smbfattr;8687int smbfs_inactive(struct vop_inactive_args *);88int smbfs_reclaim(struct vop_reclaim_args *);89int smbfs_nget(struct mount *mp, struct vnode *dvp, const char *name, int nmlen,90struct smbfattr *fap, struct vnode **vpp);91u_int32_t smbfs_hash(const u_char *name, int nmlen);9293int smbfs_getpages(struct vop_getpages_args *);94int smbfs_putpages(struct vop_putpages_args *);95int smbfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred, int *eofp);96int smbfs_writevnode(struct vnode *vp, struct uio *uiop, struct ucred *cred, int ioflag);97void smbfs_attr_cacheenter(struct vnode *vp, struct smbfattr *fap);98int smbfs_attr_cachelookup(struct vnode *vp ,struct vattr *va);99100#define smbfs_attr_cacheremove(vp) VTOSMB(vp)->n_attrage = 0101102#endif /* _FS_SMBFS_NODE_H_ */103104105