16007Sthurlow /* 26007Sthurlow * Copyright (c) 2000-2001, Boris Popov 36007Sthurlow * All rights reserved. 46007Sthurlow * 56007Sthurlow * Redistribution and use in source and binary forms, with or without 66007Sthurlow * modification, are permitted provided that the following conditions 76007Sthurlow * are met: 86007Sthurlow * 1. Redistributions of source code must retain the above copyright 96007Sthurlow * notice, this list of conditions and the following disclaimer. 106007Sthurlow * 2. Redistributions in binary form must reproduce the above copyright 116007Sthurlow * notice, this list of conditions and the following disclaimer in the 126007Sthurlow * documentation and/or other materials provided with the distribution. 136007Sthurlow * 3. All advertising materials mentioning features or use of this software 146007Sthurlow * must display the following acknowledgement: 156007Sthurlow * This product includes software developed by Boris Popov. 166007Sthurlow * 4. Neither the name of the author nor the names of any co-contributors 176007Sthurlow * may be used to endorse or promote products derived from this software 186007Sthurlow * without specific prior written permission. 196007Sthurlow * 206007Sthurlow * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 216007Sthurlow * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 226007Sthurlow * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 236007Sthurlow * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 246007Sthurlow * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 256007Sthurlow * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 266007Sthurlow * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 276007Sthurlow * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 286007Sthurlow * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 296007Sthurlow * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 306007Sthurlow * SUCH DAMAGE. 316007Sthurlow * 326007Sthurlow * $Id: smbfs.h,v 1.30.100.1 2005/05/27 02:35:28 lindak Exp $ 336007Sthurlow */ 346007Sthurlow 356007Sthurlow /* 36*13096SJordan.Vaughan@Sun.com * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. 376007Sthurlow */ 386007Sthurlow 396007Sthurlow #ifndef _SMBFS_SMBFS_H 406007Sthurlow #define _SMBFS_SMBFS_H 416007Sthurlow 426007Sthurlow /* 436007Sthurlow * FS-specific VFS structures for smbfs. 446007Sthurlow * (per-mount stuff, etc.) 456007Sthurlow * 466007Sthurlow * This file used to have mount args stuff, 476007Sthurlow * but that's now in sys/fs/smbfs_mount.h 486007Sthurlow */ 496007Sthurlow 5010023SGordon.Ross@Sun.COM #include <sys/param.h> 5110023SGordon.Ross@Sun.COM #include <sys/fstyp.h> 5211332SGordon.Ross@Sun.COM #include <sys/avl.h> 536007Sthurlow #include <sys/list.h> 5411332SGordon.Ross@Sun.COM #include <sys/t_lock.h> 556007Sthurlow #include <sys/vfs.h> 5612019SGordon.Ross@Sun.COM #include <sys/vfs_opreg.h> 576007Sthurlow #include <sys/fs/smbfs_mount.h> 58*13096SJordan.Vaughan@Sun.com #include <sys/zone.h> 596007Sthurlow 6010023SGordon.Ross@Sun.COM /* 6110023SGordon.Ross@Sun.COM * Path component length 6210023SGordon.Ross@Sun.COM * 6310023SGordon.Ross@Sun.COM * The generic fs code uses MAXNAMELEN to represent 6410023SGordon.Ross@Sun.COM * what the largest component length is, but note: 6510023SGordon.Ross@Sun.COM * that length DOES include the terminating NULL. 6610023SGordon.Ross@Sun.COM * SMB_MAXFNAMELEN does NOT include the NULL. 6710023SGordon.Ross@Sun.COM */ 6810023SGordon.Ross@Sun.COM #define SMB_MAXFNAMELEN (MAXNAMELEN-1) /* 255 */ 696007Sthurlow 706007Sthurlow /* 716007Sthurlow * SM_MAX_STATFSTIME is the maximum time to cache statvfs data. Since this 726007Sthurlow * should be a fast call on the server, the time the data cached is short. 736007Sthurlow * That lets the cache handle bursts of statvfs() requests without generating 746007Sthurlow * lots of network traffic. 756007Sthurlow */ 766007Sthurlow #define SM_MAX_STATFSTIME 2 776007Sthurlow 786007Sthurlow /* Mask values for smbmount structure sm_status field */ 796007Sthurlow #define SM_STATUS_STATFS_BUSY 0x00000001 /* statvfs is in progress */ 806007Sthurlow #define SM_STATUS_STATFS_WANT 0x00000002 /* statvfs wakeup is wanted */ 816007Sthurlow #define SM_STATUS_TIMEO 0x00000004 /* this mount is not responding */ 826007Sthurlow #define SM_STATUS_DEAD 0x00000010 /* connection gone - unmount this */ 836007Sthurlow 846007Sthurlow extern const struct fs_operation_def smbfs_vnodeops_template[]; 856007Sthurlow extern struct vnodeops *smbfs_vnodeops; 866007Sthurlow 876007Sthurlow struct smbnode; 886007Sthurlow struct smb_share; 896007Sthurlow 906007Sthurlow /* 9111332SGordon.Ross@Sun.COM * The values for smi_flags (from nfs_clnt.h) 926007Sthurlow */ 9311332SGordon.Ross@Sun.COM #define SMI_INT 0x04 /* interrupts allowed */ 9411332SGordon.Ross@Sun.COM #define SMI_NOAC 0x10 /* don't cache attributes */ 956007Sthurlow #define SMI_LLOCK 0x80 /* local locking only */ 9611332SGordon.Ross@Sun.COM #define SMI_ACL 0x2000 /* share supports ACLs */ 9711332SGordon.Ross@Sun.COM #define SMI_EXTATTR 0x80000 /* share supports ext. attrs */ 9811332SGordon.Ross@Sun.COM #define SMI_DEAD 0x200000 /* mount has been terminated */ 996007Sthurlow 1006007Sthurlow /* 10110023SGordon.Ross@Sun.COM * Stuff returned by smbfs_smb_qfsattr 10210023SGordon.Ross@Sun.COM * See [CIFS] SMB_QUERY_FS_ATTRIBUTE_INFO 10310023SGordon.Ross@Sun.COM */ 10410023SGordon.Ross@Sun.COM typedef struct smb_fs_attr_info { 10510023SGordon.Ross@Sun.COM uint32_t fsa_aflags; /* Attr. flags [CIFS 4.1.6.6] */ 10610023SGordon.Ross@Sun.COM uint32_t fsa_maxname; /* max. component length */ 10710023SGordon.Ross@Sun.COM char fsa_tname[FSTYPSZ]; /* type name, i.e. "NTFS" */ 10810023SGordon.Ross@Sun.COM } smb_fs_attr_info_t; 10910023SGordon.Ross@Sun.COM 11010023SGordon.Ross@Sun.COM /* 1116007Sthurlow * Corresponds to Darwin: struct smbmount 1126007Sthurlow */ 1136007Sthurlow typedef struct smbmntinfo { 1146007Sthurlow struct vfs *smi_vfsp; /* mount back pointer to vfs */ 1156007Sthurlow struct smbnode *smi_root; /* the root node */ 1166007Sthurlow struct smb_share *smi_share; /* netsmb SMB share conn data */ 1176007Sthurlow kmutex_t smi_lock; /* mutex for flags, etc. */ 1186007Sthurlow uint32_t smi_flags; /* NFS-derived flag bits */ 1196007Sthurlow uint32_t smi_status; /* status bits for this mount */ 1206007Sthurlow hrtime_t smi_statfstime; /* sm_statvfsbuf cache time */ 1216007Sthurlow statvfs64_t smi_statvfsbuf; /* cached statvfs data */ 1226007Sthurlow kcondvar_t smi_statvfs_cv; 12310023SGordon.Ross@Sun.COM smb_fs_attr_info_t smi_fsa; /* SMB FS attributes. */ 12410023SGordon.Ross@Sun.COM #define smi_fsattr smi_fsa.fsa_aflags 1256007Sthurlow 1266007Sthurlow /* 12711332SGordon.Ross@Sun.COM * The smbfs node cache for this mount. 12811332SGordon.Ross@Sun.COM * Named "hash" for historical reasons. 12911332SGordon.Ross@Sun.COM * See smbfs_node.h for details. 13011332SGordon.Ross@Sun.COM */ 13111332SGordon.Ross@Sun.COM avl_tree_t smi_hash_avl; 13211332SGordon.Ross@Sun.COM krwlock_t smi_hash_lk; 13311332SGordon.Ross@Sun.COM 13411332SGordon.Ross@Sun.COM /* 1356007Sthurlow * Kstat statistics 1366007Sthurlow */ 1376007Sthurlow struct kstat *smi_io_kstats; 1386007Sthurlow struct kstat *smi_ro_kstats; 1396007Sthurlow 1406007Sthurlow /* 1416007Sthurlow * Zones support. 1426007Sthurlow */ 143*13096SJordan.Vaughan@Sun.com zone_ref_t smi_zone_ref; /* Zone FS is mounted in */ 1446007Sthurlow list_node_t smi_zone_node; /* Link to per-zone smi list */ 1456007Sthurlow /* Lock for the list is: smi_globals_t -> smg_lock */ 1466007Sthurlow 1476007Sthurlow /* 14811332SGordon.Ross@Sun.COM * Stuff copied or derived from the mount args 1496007Sthurlow */ 15011332SGordon.Ross@Sun.COM uid_t smi_uid; /* user id */ 15111332SGordon.Ross@Sun.COM gid_t smi_gid; /* group id */ 15211332SGordon.Ross@Sun.COM mode_t smi_fmode; /* mode for files */ 15311332SGordon.Ross@Sun.COM mode_t smi_dmode; /* mode for dirs */ 15411332SGordon.Ross@Sun.COM 15511332SGordon.Ross@Sun.COM hrtime_t smi_acregmin; /* min time to hold cached file attr */ 15611332SGordon.Ross@Sun.COM hrtime_t smi_acregmax; /* max time to hold cached file attr */ 15711332SGordon.Ross@Sun.COM hrtime_t smi_acdirmin; /* min time to hold cached dir attr */ 15811332SGordon.Ross@Sun.COM hrtime_t smi_acdirmax; /* max time to hold cached dir attr */ 1596007Sthurlow } smbmntinfo_t; 1606007Sthurlow 16111332SGordon.Ross@Sun.COM /* 16211332SGordon.Ross@Sun.COM * Attribute cache timeout defaults (in seconds). 16311332SGordon.Ross@Sun.COM */ 16411332SGordon.Ross@Sun.COM #define SMBFS_ACREGMIN 3 /* min secs to hold cached file attr */ 16511332SGordon.Ross@Sun.COM #define SMBFS_ACREGMAX 60 /* max secs to hold cached file attr */ 16611332SGordon.Ross@Sun.COM #define SMBFS_ACDIRMIN 30 /* min secs to hold cached dir attr */ 16711332SGordon.Ross@Sun.COM #define SMBFS_ACDIRMAX 60 /* max secs to hold cached dir attr */ 16811332SGordon.Ross@Sun.COM /* and limits for the mount options */ 16911332SGordon.Ross@Sun.COM #define SMBFS_ACMINMAX 600 /* 10 min. is longest min timeout */ 17011332SGordon.Ross@Sun.COM #define SMBFS_ACMAXMAX 3600 /* 1 hr is longest max timeout */ 17111332SGordon.Ross@Sun.COM 17211332SGordon.Ross@Sun.COM /* 17311332SGordon.Ross@Sun.COM * High-res time is nanoseconds. 17411332SGordon.Ross@Sun.COM */ 17511332SGordon.Ross@Sun.COM #define SEC2HR(sec) ((sec) * (hrtime_t)NANOSEC) 1766007Sthurlow 1776007Sthurlow /* 1786007Sthurlow * vnode pointer to mount info 1796007Sthurlow */ 1806007Sthurlow #define VTOSMI(vp) ((smbmntinfo_t *)(((vp)->v_vfsp)->vfs_data)) 1816007Sthurlow #define VFTOSMI(vfsp) ((smbmntinfo_t *)((vfsp)->vfs_data)) 1826007Sthurlow #define SMBINTR(vp) (VTOSMI(vp)->smi_flags & SMI_INT) 1836007Sthurlow 1846007Sthurlow #endif /* _SMBFS_SMBFS_H */ 185