1d167cf6fSWarner Losh /*- 2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause 3d63027b6SPedro F. Giffuni * 4d122d784SJoel Dahl * Copyright (c) 2000-2001 Boris Popov 5681a5bbeSBoris Popov * All rights reserved. 6681a5bbeSBoris Popov * 7681a5bbeSBoris Popov * Redistribution and use in source and binary forms, with or without 8681a5bbeSBoris Popov * modification, are permitted provided that the following conditions 9681a5bbeSBoris Popov * are met: 10681a5bbeSBoris Popov * 1. Redistributions of source code must retain the above copyright 11681a5bbeSBoris Popov * notice, this list of conditions and the following disclaimer. 12681a5bbeSBoris Popov * 2. Redistributions in binary form must reproduce the above copyright 13681a5bbeSBoris Popov * notice, this list of conditions and the following disclaimer in the 14681a5bbeSBoris Popov * documentation and/or other materials provided with the distribution. 15681a5bbeSBoris Popov * 16681a5bbeSBoris Popov * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17681a5bbeSBoris Popov * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18681a5bbeSBoris Popov * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19681a5bbeSBoris Popov * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20681a5bbeSBoris Popov * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21681a5bbeSBoris Popov * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22681a5bbeSBoris Popov * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23681a5bbeSBoris Popov * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24681a5bbeSBoris Popov * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25681a5bbeSBoris Popov * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26681a5bbeSBoris Popov * SUCH DAMAGE. 27681a5bbeSBoris Popov */ 28681a5bbeSBoris Popov #ifndef _FS_SMBFS_NODE_H_ 29681a5bbeSBoris Popov #define _FS_SMBFS_NODE_H_ 30681a5bbeSBoris Popov 31681a5bbeSBoris Popov #define SMBFS_ROOT_INO 2 /* just like in UFS */ 32681a5bbeSBoris Popov 33681a5bbeSBoris Popov /* Bits for smbnode.n_flag */ 34681a5bbeSBoris Popov #define NFLUSHINPROG 0x0001 35681a5bbeSBoris Popov #define NFLUSHWANT 0x0002 /* they should gone ... */ 36681a5bbeSBoris Popov #define NMODIFIED 0x0004 /* bogus, until async IO implemented */ 37681a5bbeSBoris Popov /*efine NNEW 0x0008*//* smb/vnode has been allocated */ 38681a5bbeSBoris Popov #define NREFPARENT 0x0010 /* node holds parent from recycling */ 393c2f5c3cSBoris Popov #define NFLUSHWIRE 0x1000 /* pending flush request */ 402a4ad258STim J. Robbins #define NOPEN 0x2000 /* file is open */ 41b4484bf0STim J. Robbins #define NGONE 0x4000 /* file has been removed/renamed */ 42681a5bbeSBoris Popov 43681a5bbeSBoris Popov struct smbfs_fctx; 44681a5bbeSBoris Popov 45681a5bbeSBoris Popov struct smbnode { 46681a5bbeSBoris Popov int n_flag; 4711de0c59STim J. Robbins struct vnode * n_parent; 48681a5bbeSBoris Popov struct vnode * n_vnode; 49681a5bbeSBoris Popov struct smbmount * n_mount; 50681a5bbeSBoris Popov time_t n_attrage; /* attributes cache time */ 51681a5bbeSBoris Popov /* time_t n_ctime;*/ 52681a5bbeSBoris Popov struct timespec n_mtime; /* modify time */ 53681a5bbeSBoris Popov struct timespec n_atime; /* last access time */ 54681a5bbeSBoris Popov u_quad_t n_size; 55681a5bbeSBoris Popov long n_ino; 5680704a47SDavide Italiano long n_parentino; /* parent inode number */ 57681a5bbeSBoris Popov int n_dosattr; 58681a5bbeSBoris Popov u_int16_t n_fid; /* file handle */ 59681a5bbeSBoris Popov int n_rwstate; /* granted access mode */ 6080704a47SDavide Italiano int n_rplen; 6180704a47SDavide Italiano char * n_rpath; 62681a5bbeSBoris Popov u_char n_nmlen; 63681a5bbeSBoris Popov u_char * n_name; 64681a5bbeSBoris Popov struct smbfs_fctx * n_dirseq; /* ff context */ 65681a5bbeSBoris Popov long n_dirofs; /* last ff offset */ 66681a5bbeSBoris Popov LIST_ENTRY(smbnode) n_hash; 67681a5bbeSBoris Popov }; 68681a5bbeSBoris Popov 698680dc80SDavide Italiano struct smbcmp { 708680dc80SDavide Italiano struct vnode * n_parent; 718680dc80SDavide Italiano int n_nmlen; 728680dc80SDavide Italiano const char * n_name; 738680dc80SDavide Italiano }; 748680dc80SDavide Italiano 75681a5bbeSBoris Popov #define VTOSMB(vp) ((struct smbnode *)(vp)->v_data) 76681a5bbeSBoris Popov #define SMBTOV(np) ((struct vnode *)(np)->n_vnode) 77681a5bbeSBoris Popov 7880704a47SDavide Italiano #define SMBFS_DNP_SEP(dnp) ((dnp->n_rplen > 1) ? '\\' : '\0') 7980704a47SDavide Italiano 80681a5bbeSBoris Popov struct vop_getpages_args; 81681a5bbeSBoris Popov struct vop_inactive_args; 82681a5bbeSBoris Popov struct vop_putpages_args; 83681a5bbeSBoris Popov struct vop_reclaim_args; 84681a5bbeSBoris Popov struct ucred; 85681a5bbeSBoris Popov struct uio; 86681a5bbeSBoris Popov struct smbfattr; 87681a5bbeSBoris Popov 88681a5bbeSBoris Popov int smbfs_inactive(struct vop_inactive_args *); 89681a5bbeSBoris Popov int smbfs_reclaim(struct vop_reclaim_args *); 90681a5bbeSBoris Popov int smbfs_nget(struct mount *mp, struct vnode *dvp, const char *name, int nmlen, 91681a5bbeSBoris Popov struct smbfattr *fap, struct vnode **vpp); 92681a5bbeSBoris Popov u_int32_t smbfs_hash(const u_char *name, int nmlen); 93681a5bbeSBoris Popov 94681a5bbeSBoris Popov int smbfs_getpages(struct vop_getpages_args *); 95681a5bbeSBoris Popov int smbfs_putpages(struct vop_putpages_args *); 96681a5bbeSBoris Popov int smbfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred); 97681a5bbeSBoris Popov int smbfs_writevnode(struct vnode *vp, struct uio *uiop, struct ucred *cred, int ioflag); 98681a5bbeSBoris Popov void smbfs_attr_cacheenter(struct vnode *vp, struct smbfattr *fap); 99681a5bbeSBoris Popov int smbfs_attr_cachelookup(struct vnode *vp ,struct vattr *va); 100681a5bbeSBoris Popov 101681a5bbeSBoris Popov #define smbfs_attr_cacheremove(vp) VTOSMB(vp)->n_attrage = 0 102681a5bbeSBoris Popov 103681a5bbeSBoris Popov #endif /* _FS_SMBFS_NODE_H_ */ 104