1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2000-2001 Boris Popov 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * $FreeBSD$ 29 */ 30 #ifndef _FS_SMBFS_NODE_H_ 31 #define _FS_SMBFS_NODE_H_ 32 33 #define SMBFS_ROOT_INO 2 /* just like in UFS */ 34 35 /* Bits for smbnode.n_flag */ 36 #define NFLUSHINPROG 0x0001 37 #define NFLUSHWANT 0x0002 /* they should gone ... */ 38 #define NMODIFIED 0x0004 /* bogus, until async IO implemented */ 39 /*efine NNEW 0x0008*//* smb/vnode has been allocated */ 40 #define NREFPARENT 0x0010 /* node holds parent from recycling */ 41 #define NFLUSHWIRE 0x1000 /* pending flush request */ 42 #define NOPEN 0x2000 /* file is open */ 43 #define NGONE 0x4000 /* file has been removed/renamed */ 44 45 struct smbfs_fctx; 46 47 struct smbnode { 48 int n_flag; 49 struct vnode * n_parent; 50 struct vnode * n_vnode; 51 struct smbmount * n_mount; 52 time_t n_attrage; /* attributes cache time */ 53 /* time_t n_ctime;*/ 54 struct timespec n_mtime; /* modify time */ 55 struct timespec n_atime; /* last access time */ 56 u_quad_t n_size; 57 long n_ino; 58 long n_parentino; /* parent inode number */ 59 int n_dosattr; 60 u_int16_t n_fid; /* file handle */ 61 int n_rwstate; /* granted access mode */ 62 int n_rplen; 63 char * n_rpath; 64 u_char n_nmlen; 65 u_char * n_name; 66 struct smbfs_fctx * n_dirseq; /* ff context */ 67 long n_dirofs; /* last ff offset */ 68 LIST_ENTRY(smbnode) n_hash; 69 }; 70 71 struct smbcmp { 72 struct vnode * n_parent; 73 int n_nmlen; 74 const char * n_name; 75 }; 76 77 #define VTOSMB(vp) ((struct smbnode *)(vp)->v_data) 78 #define SMBTOV(np) ((struct vnode *)(np)->n_vnode) 79 80 #define SMBFS_DNP_SEP(dnp) ((dnp->n_rplen > 1) ? '\\' : '\0') 81 82 struct vop_getpages_args; 83 struct vop_inactive_args; 84 struct vop_putpages_args; 85 struct vop_reclaim_args; 86 struct ucred; 87 struct uio; 88 struct smbfattr; 89 90 int smbfs_inactive(struct vop_inactive_args *); 91 int smbfs_reclaim(struct vop_reclaim_args *); 92 int smbfs_nget(struct mount *mp, struct vnode *dvp, const char *name, int nmlen, 93 struct smbfattr *fap, struct vnode **vpp); 94 u_int32_t smbfs_hash(const u_char *name, int nmlen); 95 96 int smbfs_getpages(struct vop_getpages_args *); 97 int smbfs_putpages(struct vop_putpages_args *); 98 int smbfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred); 99 int smbfs_writevnode(struct vnode *vp, struct uio *uiop, struct ucred *cred, int ioflag); 100 void smbfs_attr_cacheenter(struct vnode *vp, struct smbfattr *fap); 101 int smbfs_attr_cachelookup(struct vnode *vp ,struct vattr *va); 102 103 #define smbfs_attr_cacheremove(vp) VTOSMB(vp)->n_attrage = 0 104 105 #endif /* _FS_SMBFS_NODE_H_ */ 106