1*ba2539a9Schs /* 2*ba2539a9Schs * CDDL HEADER START 3*ba2539a9Schs * 4*ba2539a9Schs * The contents of this file are subject to the terms of the 5*ba2539a9Schs * Common Development and Distribution License (the "License"). 6*ba2539a9Schs * You may not use this file except in compliance with the License. 7*ba2539a9Schs * 8*ba2539a9Schs * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*ba2539a9Schs * or http://www.opensolaris.org/os/licensing. 10*ba2539a9Schs * See the License for the specific language governing permissions 11*ba2539a9Schs * and limitations under the License. 12*ba2539a9Schs * 13*ba2539a9Schs * When distributing Covered Code, include this CDDL HEADER in each 14*ba2539a9Schs * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*ba2539a9Schs * If applicable, add the following below this CDDL HEADER, with the 16*ba2539a9Schs * fields enclosed by brackets "[]" replaced with your own identifying 17*ba2539a9Schs * information: Portions Copyright [yyyy] [name of copyright owner] 18*ba2539a9Schs * 19*ba2539a9Schs * CDDL HEADER END 20*ba2539a9Schs */ 21*ba2539a9Schs 22*ba2539a9Schs /* 23*ba2539a9Schs * Copyright (c) 1988, 2010, Oracle and/or its affiliates. All rights reserved. 24*ba2539a9Schs */ 25*ba2539a9Schs 26*ba2539a9Schs /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 27*ba2539a9Schs /* All Rights Reserved */ 28*ba2539a9Schs 29*ba2539a9Schs /* 30*ba2539a9Schs * University Copyright- Copyright (c) 1982, 1986, 1988 31*ba2539a9Schs * The Regents of the University of California 32*ba2539a9Schs * All Rights Reserved 33*ba2539a9Schs * 34*ba2539a9Schs * University Acknowledgment- Portions of this document are derived from 35*ba2539a9Schs * software developed by the University of California, Berkeley, and its 36*ba2539a9Schs * contributors. 37*ba2539a9Schs */ 38*ba2539a9Schs 39*ba2539a9Schs #ifndef _UTS_SYS_VNODE_H 40*ba2539a9Schs #define _UTS_SYS_VNODE_H 41*ba2539a9Schs 42*ba2539a9Schs #include_next <sys/vnode.h> 43*ba2539a9Schs 44*ba2539a9Schs #define IS_DEVVP(vp) \ 45*ba2539a9Schs ((vp)->v_type == VCHR || (vp)->v_type == VBLK || (vp)->v_type == VFIFO) 46*ba2539a9Schs 47*ba2539a9Schs #define V_XATTRDIR 0x0000 /* attribute unnamed directory */ 48*ba2539a9Schs 49*ba2539a9Schs #define AV_SCANSTAMP_SZ 32 /* length of anti-virus scanstamp */ 50*ba2539a9Schs 51*ba2539a9Schs /* 52*ba2539a9Schs * Structure of all optional attributes. 53*ba2539a9Schs */ 54*ba2539a9Schs typedef struct xoptattr { 55*ba2539a9Schs timestruc_t xoa_createtime; /* Create time of file */ 56*ba2539a9Schs uint8_t xoa_archive; 57*ba2539a9Schs uint8_t xoa_system; 58*ba2539a9Schs uint8_t xoa_readonly; 59*ba2539a9Schs uint8_t xoa_hidden; 60*ba2539a9Schs uint8_t xoa_nounlink; 61*ba2539a9Schs uint8_t xoa_immutable; 62*ba2539a9Schs uint8_t xoa_appendonly; 63*ba2539a9Schs uint8_t xoa_nodump; 64*ba2539a9Schs uint8_t xoa_opaque; 65*ba2539a9Schs uint8_t xoa_av_quarantined; 66*ba2539a9Schs uint8_t xoa_av_modified; 67*ba2539a9Schs uint8_t xoa_av_scanstamp[AV_SCANSTAMP_SZ]; 68*ba2539a9Schs uint8_t xoa_reparse; 69*ba2539a9Schs uint64_t xoa_generation; 70*ba2539a9Schs uint8_t xoa_offline; 71*ba2539a9Schs uint8_t xoa_sparse; 72*ba2539a9Schs } xoptattr_t; 73*ba2539a9Schs 74*ba2539a9Schs /* 75*ba2539a9Schs * The xvattr structure is really a variable length structure that 76*ba2539a9Schs * is made up of: 77*ba2539a9Schs * - The classic vattr_t (xva_vattr) 78*ba2539a9Schs * - a 32 bit quantity (xva_mapsize) that specifies the size of the 79*ba2539a9Schs * attribute bitmaps in 32 bit words. 80*ba2539a9Schs * - A pointer to the returned attribute bitmap (needed because the 81*ba2539a9Schs * previous element, the requested attribute bitmap) is variable lenth. 82*ba2539a9Schs * - The requested attribute bitmap, which is an array of 32 bit words. 83*ba2539a9Schs * Callers use the XVA_SET_REQ() macro to set the bits corresponding to 84*ba2539a9Schs * the attributes that are being requested. 85*ba2539a9Schs * - The returned attribute bitmap, which is an array of 32 bit words. 86*ba2539a9Schs * File systems that support optional attributes use the XVA_SET_RTN() 87*ba2539a9Schs * macro to set the bits corresponding to the attributes that are being 88*ba2539a9Schs * returned. 89*ba2539a9Schs * - The xoptattr_t structure which contains the attribute values 90*ba2539a9Schs * 91*ba2539a9Schs * xva_mapsize determines how many words in the attribute bitmaps. 92*ba2539a9Schs * Immediately following the attribute bitmaps is the xoptattr_t. 93*ba2539a9Schs * xva_getxoptattr() is used to get the pointer to the xoptattr_t 94*ba2539a9Schs * section. 95*ba2539a9Schs */ 96*ba2539a9Schs 97*ba2539a9Schs #define XVA_MAPSIZE 3 /* Size of attr bitmaps */ 98*ba2539a9Schs #define XVA_MAGIC 0x78766174 /* Magic # for verification */ 99*ba2539a9Schs 100*ba2539a9Schs /* 101*ba2539a9Schs * The xvattr structure is an extensible structure which permits optional 102*ba2539a9Schs * attributes to be requested/returned. File systems may or may not support 103*ba2539a9Schs * optional attributes. They do so at their own discretion but if they do 104*ba2539a9Schs * support optional attributes, they must register the VFSFT_XVATTR feature 105*ba2539a9Schs * so that the optional attributes can be set/retrived. 106*ba2539a9Schs * 107*ba2539a9Schs * The fields of the xvattr structure are: 108*ba2539a9Schs * 109*ba2539a9Schs * xva_vattr - The first element of an xvattr is a legacy vattr structure 110*ba2539a9Schs * which includes the common attributes. If AT_XVATTR is set in the va_mask 111*ba2539a9Schs * then the entire structure is treated as an xvattr. If AT_XVATTR is not 112*ba2539a9Schs * set, then only the xva_vattr structure can be used. 113*ba2539a9Schs * 114*ba2539a9Schs * xva_magic - 0x78766174 (hex for "xvat"). Magic number for verification. 115*ba2539a9Schs * 116*ba2539a9Schs * xva_mapsize - Size of requested and returned attribute bitmaps. 117*ba2539a9Schs * 118*ba2539a9Schs * xva_rtnattrmapp - Pointer to xva_rtnattrmap[]. We need this since the 119*ba2539a9Schs * size of the array before it, xva_reqattrmap[], could change which means 120*ba2539a9Schs * the location of xva_rtnattrmap[] could change. This will allow unbundled 121*ba2539a9Schs * file systems to find the location of xva_rtnattrmap[] when the sizes change. 122*ba2539a9Schs * 123*ba2539a9Schs * xva_reqattrmap[] - Array of requested attributes. Attributes are 124*ba2539a9Schs * represented by a specific bit in a specific element of the attribute 125*ba2539a9Schs * map array. Callers set the bits corresponding to the attributes 126*ba2539a9Schs * that the caller wants to get/set. 127*ba2539a9Schs * 128*ba2539a9Schs * xva_rtnattrmap[] - Array of attributes that the file system was able to 129*ba2539a9Schs * process. Not all file systems support all optional attributes. This map 130*ba2539a9Schs * informs the caller which attributes the underlying file system was able 131*ba2539a9Schs * to set/get. (Same structure as the requested attributes array in terms 132*ba2539a9Schs * of each attribute corresponding to specific bits and array elements.) 133*ba2539a9Schs * 134*ba2539a9Schs * xva_xoptattrs - Structure containing values of optional attributes. 135*ba2539a9Schs * These values are only valid if the corresponding bits in xva_reqattrmap 136*ba2539a9Schs * are set and the underlying file system supports those attributes. 137*ba2539a9Schs */ 138*ba2539a9Schs typedef struct xvattr { 139*ba2539a9Schs vattr_t xva_vattr; /* Embedded vattr structure */ 140*ba2539a9Schs uint32_t xva_magic; /* Magic Number */ 141*ba2539a9Schs uint32_t xva_mapsize; /* Size of attr bitmap (32-bit words) */ 142*ba2539a9Schs uint32_t *xva_rtnattrmapp; /* Ptr to xva_rtnattrmap[] */ 143*ba2539a9Schs uint32_t xva_reqattrmap[XVA_MAPSIZE]; /* Requested attrs */ 144*ba2539a9Schs uint32_t xva_rtnattrmap[XVA_MAPSIZE]; /* Returned attrs */ 145*ba2539a9Schs xoptattr_t xva_xoptattrs; /* Optional attributes */ 146*ba2539a9Schs } xvattr_t; 147*ba2539a9Schs 148*ba2539a9Schs /* 149*ba2539a9Schs * Attributes of interest to the caller of setattr or getattr. 150*ba2539a9Schs */ 151*ba2539a9Schs #define AT_TYPE 0x00001 152*ba2539a9Schs #define AT_MODE 0x00002 153*ba2539a9Schs #define AT_UID 0x00004 154*ba2539a9Schs #define AT_GID 0x00008 155*ba2539a9Schs #define AT_FSID 0x00010 156*ba2539a9Schs #define AT_NODEID 0x00020 157*ba2539a9Schs #define AT_NLINK 0x00040 158*ba2539a9Schs #define AT_SIZE 0x00080 159*ba2539a9Schs #define AT_ATIME 0x00100 160*ba2539a9Schs #define AT_MTIME 0x00200 161*ba2539a9Schs #define AT_CTIME 0x00400 162*ba2539a9Schs #define AT_RDEV 0x00800 163*ba2539a9Schs #define AT_BLKSIZE 0x01000 164*ba2539a9Schs #define AT_NBLOCKS 0x02000 165*ba2539a9Schs /* 0x04000 */ /* unused */ 166*ba2539a9Schs #define AT_SEQ 0x08000 167*ba2539a9Schs /* 168*ba2539a9Schs * If AT_XVATTR is set then there are additional bits to process in 169*ba2539a9Schs * the xvattr_t's attribute bitmap. If this is not set then the bitmap 170*ba2539a9Schs * MUST be ignored. Note that this bit must be set/cleared explicitly. 171*ba2539a9Schs * That is, setting AT_ALL will NOT set AT_XVATTR. 172*ba2539a9Schs */ 173*ba2539a9Schs #define AT_XVATTR 0x10000 174*ba2539a9Schs 175*ba2539a9Schs #define AT_ALL (AT_TYPE|AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|\ 176*ba2539a9Schs AT_NLINK|AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|\ 177*ba2539a9Schs AT_RDEV|AT_BLKSIZE|AT_NBLOCKS|AT_SEQ) 178*ba2539a9Schs 179*ba2539a9Schs #define AT_STAT (AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|AT_NLINK|\ 180*ba2539a9Schs AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|AT_RDEV|AT_TYPE) 181*ba2539a9Schs 182*ba2539a9Schs #define AT_TIMES (AT_ATIME|AT_MTIME|AT_CTIME) 183*ba2539a9Schs 184*ba2539a9Schs #define AT_NOSET (AT_NLINK|AT_RDEV|AT_FSID|AT_NODEID|AT_TYPE|\ 185*ba2539a9Schs AT_BLKSIZE|AT_NBLOCKS|AT_SEQ) 186*ba2539a9Schs 187*ba2539a9Schs /* 188*ba2539a9Schs * Attribute bits used in the extensible attribute's (xva's) attribute 189*ba2539a9Schs * bitmaps. Note that the bitmaps are made up of a variable length number 190*ba2539a9Schs * of 32-bit words. The convention is to use XAT{n}_{attrname} where "n" 191*ba2539a9Schs * is the element in the bitmap (starting at 1). This convention is for 192*ba2539a9Schs * the convenience of the maintainer to keep track of which element each 193*ba2539a9Schs * attribute belongs to. 194*ba2539a9Schs * 195*ba2539a9Schs * NOTE THAT CONSUMERS MUST *NOT* USE THE XATn_* DEFINES DIRECTLY. CONSUMERS 196*ba2539a9Schs * MUST USE THE XAT_* DEFINES. 197*ba2539a9Schs */ 198*ba2539a9Schs #define XAT0_INDEX 0LL /* Index into bitmap for XAT0 attrs */ 199*ba2539a9Schs #define XAT0_CREATETIME 0x00000001 /* Create time of file */ 200*ba2539a9Schs #define XAT0_ARCHIVE 0x00000002 /* Archive */ 201*ba2539a9Schs #define XAT0_SYSTEM 0x00000004 /* System */ 202*ba2539a9Schs #define XAT0_READONLY 0x00000008 /* Readonly */ 203*ba2539a9Schs #define XAT0_HIDDEN 0x00000010 /* Hidden */ 204*ba2539a9Schs #define XAT0_NOUNLINK 0x00000020 /* Nounlink */ 205*ba2539a9Schs #define XAT0_IMMUTABLE 0x00000040 /* immutable */ 206*ba2539a9Schs #define XAT0_APPENDONLY 0x00000080 /* appendonly */ 207*ba2539a9Schs #define XAT0_NODUMP 0x00000100 /* nodump */ 208*ba2539a9Schs #define XAT0_OPAQUE 0x00000200 /* opaque */ 209*ba2539a9Schs #define XAT0_AV_QUARANTINED 0x00000400 /* anti-virus quarantine */ 210*ba2539a9Schs #define XAT0_AV_MODIFIED 0x00000800 /* anti-virus modified */ 211*ba2539a9Schs #define XAT0_AV_SCANSTAMP 0x00001000 /* anti-virus scanstamp */ 212*ba2539a9Schs #define XAT0_REPARSE 0x00002000 /* FS reparse point */ 213*ba2539a9Schs #define XAT0_GEN 0x00004000 /* object generation number */ 214*ba2539a9Schs #define XAT0_OFFLINE 0x00008000 /* offline */ 215*ba2539a9Schs #define XAT0_SPARSE 0x00010000 /* sparse */ 216*ba2539a9Schs 217*ba2539a9Schs #define XAT0_ALL_ATTRS (XAT0_CREATETIME|XAT0_ARCHIVE|XAT0_SYSTEM| \ 218*ba2539a9Schs XAT0_READONLY|XAT0_HIDDEN|XAT0_NOUNLINK|XAT0_IMMUTABLE|XAT0_APPENDONLY| \ 219*ba2539a9Schs XAT0_NODUMP|XAT0_OPAQUE|XAT0_AV_QUARANTINED| XAT0_AV_MODIFIED| \ 220*ba2539a9Schs XAT0_AV_SCANSTAMP|XAT0_REPARSE|XATO_GEN|XAT0_OFFLINE|XAT0_SPARSE) 221*ba2539a9Schs 222*ba2539a9Schs /* Support for XAT_* optional attributes */ 223*ba2539a9Schs #define XVA_MASK 0xffffffff /* Used to mask off 32 bits */ 224*ba2539a9Schs #define XVA_SHFT 32 /* Used to shift index */ 225*ba2539a9Schs 226*ba2539a9Schs /* 227*ba2539a9Schs * Used to pry out the index and attribute bits from the XAT_* attributes 228*ba2539a9Schs * defined below. Note that we're masking things down to 32 bits then 229*ba2539a9Schs * casting to uint32_t. 230*ba2539a9Schs */ 231*ba2539a9Schs #define XVA_INDEX(attr) ((uint32_t)(((attr) >> XVA_SHFT) & XVA_MASK)) 232*ba2539a9Schs #define XVA_ATTRBIT(attr) ((uint32_t)((attr) & XVA_MASK)) 233*ba2539a9Schs 234*ba2539a9Schs /* 235*ba2539a9Schs * The following defines present a "flat namespace" so that consumers don't 236*ba2539a9Schs * need to keep track of which element belongs to which bitmap entry. 237*ba2539a9Schs * 238*ba2539a9Schs * NOTE THAT THESE MUST NEVER BE OR-ed TOGETHER 239*ba2539a9Schs */ 240*ba2539a9Schs #define XAT_CREATETIME ((XAT0_INDEX << XVA_SHFT) | XAT0_CREATETIME) 241*ba2539a9Schs #define XAT_ARCHIVE ((XAT0_INDEX << XVA_SHFT) | XAT0_ARCHIVE) 242*ba2539a9Schs #define XAT_SYSTEM ((XAT0_INDEX << XVA_SHFT) | XAT0_SYSTEM) 243*ba2539a9Schs #define XAT_READONLY ((XAT0_INDEX << XVA_SHFT) | XAT0_READONLY) 244*ba2539a9Schs #define XAT_HIDDEN ((XAT0_INDEX << XVA_SHFT) | XAT0_HIDDEN) 245*ba2539a9Schs #define XAT_NOUNLINK ((XAT0_INDEX << XVA_SHFT) | XAT0_NOUNLINK) 246*ba2539a9Schs #define XAT_IMMUTABLE ((XAT0_INDEX << XVA_SHFT) | XAT0_IMMUTABLE) 247*ba2539a9Schs #define XAT_APPENDONLY ((XAT0_INDEX << XVA_SHFT) | XAT0_APPENDONLY) 248*ba2539a9Schs #define XAT_NODUMP ((XAT0_INDEX << XVA_SHFT) | XAT0_NODUMP) 249*ba2539a9Schs #define XAT_OPAQUE ((XAT0_INDEX << XVA_SHFT) | XAT0_OPAQUE) 250*ba2539a9Schs #define XAT_AV_QUARANTINED ((XAT0_INDEX << XVA_SHFT) | XAT0_AV_QUARANTINED) 251*ba2539a9Schs #define XAT_AV_MODIFIED ((XAT0_INDEX << XVA_SHFT) | XAT0_AV_MODIFIED) 252*ba2539a9Schs #define XAT_AV_SCANSTAMP ((XAT0_INDEX << XVA_SHFT) | XAT0_AV_SCANSTAMP) 253*ba2539a9Schs #define XAT_REPARSE ((XAT0_INDEX << XVA_SHFT) | XAT0_REPARSE) 254*ba2539a9Schs #define XAT_GEN ((XAT0_INDEX << XVA_SHFT) | XAT0_GEN) 255*ba2539a9Schs #define XAT_OFFLINE ((XAT0_INDEX << XVA_SHFT) | XAT0_OFFLINE) 256*ba2539a9Schs #define XAT_SPARSE ((XAT0_INDEX << XVA_SHFT) | XAT0_SPARSE) 257*ba2539a9Schs 258*ba2539a9Schs /* 259*ba2539a9Schs * The returned attribute map array (xva_rtnattrmap[]) is located past the 260*ba2539a9Schs * requested attribute map array (xva_reqattrmap[]). Its location changes 261*ba2539a9Schs * when the array sizes change. We use a separate pointer in a known location 262*ba2539a9Schs * (xva_rtnattrmapp) to hold the location of xva_rtnattrmap[]. This is 263*ba2539a9Schs * set in xva_init() 264*ba2539a9Schs */ 265*ba2539a9Schs #define XVA_RTNATTRMAP(xvap) ((xvap)->xva_rtnattrmapp) 266*ba2539a9Schs 267*ba2539a9Schs /* 268*ba2539a9Schs * XVA_SET_REQ() sets an attribute bit in the proper element in the bitmap 269*ba2539a9Schs * of requested attributes (xva_reqattrmap[]). 270*ba2539a9Schs */ 271*ba2539a9Schs #define XVA_SET_REQ(xvap, attr) { \ 272*ba2539a9Schs ASSERT((xvap)->xva_vattr.va_mask | AT_XVATTR); \ 273*ba2539a9Schs ASSERT((xvap)->xva_magic == XVA_MAGIC); \ 274*ba2539a9Schs (xvap)->xva_reqattrmap[XVA_INDEX(attr)] |= XVA_ATTRBIT(attr); \ 275*ba2539a9Schs } 276*ba2539a9Schs /* 277*ba2539a9Schs * XVA_CLR_REQ() clears an attribute bit in the proper element in the bitmap 278*ba2539a9Schs * of requested attributes (xva_reqattrmap[]). 279*ba2539a9Schs */ 280*ba2539a9Schs #define XVA_CLR_REQ(xvap, attr) { \ 281*ba2539a9Schs ASSERT((xvap)->xva_vattr.va_mask | AT_XVATTR); \ 282*ba2539a9Schs ASSERT((xvap)->xva_magic == XVA_MAGIC); \ 283*ba2539a9Schs (xvap)->xva_reqattrmap[XVA_INDEX(attr)] &= ~XVA_ATTRBIT(attr); \ 284*ba2539a9Schs } 285*ba2539a9Schs 286*ba2539a9Schs /* 287*ba2539a9Schs * XVA_SET_RTN() sets an attribute bit in the proper element in the bitmap 288*ba2539a9Schs * of returned attributes (xva_rtnattrmap[]). 289*ba2539a9Schs */ 290*ba2539a9Schs #define XVA_SET_RTN(xvap, attr) { \ 291*ba2539a9Schs ASSERT((xvap)->xva_vattr.va_mask | AT_XVATTR); \ 292*ba2539a9Schs ASSERT((xvap)->xva_magic == XVA_MAGIC); \ 293*ba2539a9Schs (XVA_RTNATTRMAP(xvap))[XVA_INDEX(attr)] |= XVA_ATTRBIT(attr); \ 294*ba2539a9Schs } 295*ba2539a9Schs 296*ba2539a9Schs /* 297*ba2539a9Schs * XVA_ISSET_REQ() checks the requested attribute bitmap (xva_reqattrmap[]) 298*ba2539a9Schs * to see of the corresponding attribute bit is set. If so, returns non-zero. 299*ba2539a9Schs */ 300*ba2539a9Schs #define XVA_ISSET_REQ(xvap, attr) \ 301*ba2539a9Schs ((((xvap)->xva_vattr.va_mask | AT_XVATTR) && \ 302*ba2539a9Schs ((xvap)->xva_magic == XVA_MAGIC) && \ 303*ba2539a9Schs ((xvap)->xva_mapsize > XVA_INDEX(attr))) ? \ 304*ba2539a9Schs ((xvap)->xva_reqattrmap[XVA_INDEX(attr)] & XVA_ATTRBIT(attr)) : 0) 305*ba2539a9Schs 306*ba2539a9Schs /* 307*ba2539a9Schs * XVA_ISSET_RTN() checks the returned attribute bitmap (xva_rtnattrmap[]) 308*ba2539a9Schs * to see of the corresponding attribute bit is set. If so, returns non-zero. 309*ba2539a9Schs */ 310*ba2539a9Schs #define XVA_ISSET_RTN(xvap, attr) \ 311*ba2539a9Schs ((((xvap)->xva_vattr.va_mask | AT_XVATTR) && \ 312*ba2539a9Schs ((xvap)->xva_magic == XVA_MAGIC) && \ 313*ba2539a9Schs ((xvap)->xva_mapsize > XVA_INDEX(attr))) ? \ 314*ba2539a9Schs ((XVA_RTNATTRMAP(xvap))[XVA_INDEX(attr)] & XVA_ATTRBIT(attr)) : 0) 315*ba2539a9Schs 316*ba2539a9Schs #define MODEMASK 07777 /* mode bits plus permission bits */ 317*ba2539a9Schs #define PERMMASK 00777 /* permission bits */ 318*ba2539a9Schs 319*ba2539a9Schs /* 320*ba2539a9Schs * VOP_ACCESS flags 321*ba2539a9Schs */ 322*ba2539a9Schs #define V_ACE_MASK 0x1 /* mask represents NFSv4 ACE permissions */ 323*ba2539a9Schs 324*ba2539a9Schs /* 325*ba2539a9Schs * Flags for vnode operations. 326*ba2539a9Schs */ 327*ba2539a9Schs enum rm { RMFILE, RMDIRECTORY }; /* rm or rmdir (remove) */ 328*ba2539a9Schs enum create { CRCREAT, CRMKNOD, CRMKDIR }; /* reason for create */ 329*ba2539a9Schs 330*ba2539a9Schs /* 331*ba2539a9Schs * Structure used on VOP_GETSECATTR and VOP_SETSECATTR operations 332*ba2539a9Schs */ 333*ba2539a9Schs 334*ba2539a9Schs typedef struct vsecattr { 335*ba2539a9Schs uint_t vsa_mask; /* See below */ 336*ba2539a9Schs int vsa_aclcnt; /* ACL entry count */ 337*ba2539a9Schs void *vsa_aclentp; /* pointer to ACL entries */ 338*ba2539a9Schs int vsa_dfaclcnt; /* default ACL entry count */ 339*ba2539a9Schs void *vsa_dfaclentp; /* pointer to default ACL entries */ 340*ba2539a9Schs size_t vsa_aclentsz; /* ACE size in bytes of vsa_aclentp */ 341*ba2539a9Schs uint_t vsa_aclflags; /* ACE ACL flags */ 342*ba2539a9Schs } vsecattr_t; 343*ba2539a9Schs 344*ba2539a9Schs /* vsa_mask values */ 345*ba2539a9Schs #define VSA_ACL 0x0001 346*ba2539a9Schs #define VSA_ACLCNT 0x0002 347*ba2539a9Schs #define VSA_DFACL 0x0004 348*ba2539a9Schs #define VSA_DFACLCNT 0x0008 349*ba2539a9Schs #define VSA_ACE 0x0010 350*ba2539a9Schs #define VSA_ACECNT 0x0020 351*ba2539a9Schs #define VSA_ACE_ALLTYPES 0x0040 352*ba2539a9Schs #define VSA_ACE_ACLFLAGS 0x0080 /* get/set ACE ACL flags */ 353*ba2539a9Schs 354*ba2539a9Schs /* 355*ba2539a9Schs * Structure used by various vnode operations to determine 356*ba2539a9Schs * the context (pid, host, identity) of a caller. 357*ba2539a9Schs * 358*ba2539a9Schs * The cc_caller_id is used to identify one or more callers who invoke 359*ba2539a9Schs * operations, possibly on behalf of others. For example, the NFS 360*ba2539a9Schs * server could have it's own cc_caller_id which can be detected by 361*ba2539a9Schs * vnode/vfs operations or (FEM) monitors on those operations. New 362*ba2539a9Schs * caller IDs are generated by fs_new_caller_id(). 363*ba2539a9Schs */ 364*ba2539a9Schs typedef struct caller_context { 365*ba2539a9Schs pid_t cc_pid; /* Process ID of the caller */ 366*ba2539a9Schs int cc_sysid; /* System ID, used for remote calls */ 367*ba2539a9Schs u_longlong_t cc_caller_id; /* Identifier for (set of) caller(s) */ 368*ba2539a9Schs ulong_t cc_flags; 369*ba2539a9Schs } caller_context_t; 370*ba2539a9Schs 371*ba2539a9Schs struct taskq; 372*ba2539a9Schs 373*ba2539a9Schs /* 374*ba2539a9Schs * Flags for VOP_LOOKUP 375*ba2539a9Schs * 376*ba2539a9Schs * Defined in file.h, but also possible, FIGNORECASE and FSEARCH 377*ba2539a9Schs * 378*ba2539a9Schs */ 379*ba2539a9Schs #define LOOKUP_DIR 0x01 /* want parent dir vp */ 380*ba2539a9Schs #define LOOKUP_XATTR 0x02 /* lookup up extended attr dir */ 381*ba2539a9Schs #define CREATE_XATTR_DIR 0x04 /* Create extended attr dir */ 382*ba2539a9Schs #define LOOKUP_HAVE_SYSATTR_DIR 0x08 /* Already created virtual GFS dir */ 383*ba2539a9Schs 384*ba2539a9Schs /* 385*ba2539a9Schs * Flags for VOP_READDIR 386*ba2539a9Schs */ 387*ba2539a9Schs #define V_RDDIR_ENTFLAGS 0x01 /* request dirent flags */ 388*ba2539a9Schs #define V_RDDIR_ACCFILTER 0x02 /* filter out inaccessible dirents */ 389*ba2539a9Schs 390*ba2539a9Schs /* 391*ba2539a9Schs * Public vnode manipulation functions. 392*ba2539a9Schs */ 393*ba2539a9Schs #ifdef _KERNEL 394*ba2539a9Schs 395*ba2539a9Schs void vn_rele_async(struct vnode *vp, struct taskq *taskq); 396*ba2539a9Schs 397*ba2539a9Schs /* 398*ba2539a9Schs * Extensible vnode attribute (xva) routines: 399*ba2539a9Schs * xva_init() initializes an xvattr_t (zero struct, init mapsize, set AT_XATTR) 400*ba2539a9Schs * xva_getxoptattr() returns a ponter to the xoptattr_t section of xvattr_t 401*ba2539a9Schs */ 402*ba2539a9Schs void xva_init(xvattr_t *); 403*ba2539a9Schs xoptattr_t *xva_getxoptattr(xvattr_t *); /* Get ptr to xoptattr_t */ 404*ba2539a9Schs 405*ba2539a9Schs #define VN_RELE_ASYNC(vp, taskq) { \ 406*ba2539a9Schs vn_rele_async(vp, taskq); \ 407*ba2539a9Schs } 408*ba2539a9Schs 409*ba2539a9Schs #endif /* _KERNEL */ 410*ba2539a9Schs 411*ba2539a9Schs /* 412*ba2539a9Schs * Flags to VOP_SETATTR/VOP_GETATTR. 413*ba2539a9Schs */ 414*ba2539a9Schs #define ATTR_UTIME 0x01 /* non-default utime(2) request */ 415*ba2539a9Schs #define ATTR_EXEC 0x02 /* invocation from exec(2) */ 416*ba2539a9Schs #define ATTR_COMM 0x04 /* yield common vp attributes */ 417*ba2539a9Schs #define ATTR_HINT 0x08 /* information returned will be `hint' */ 418*ba2539a9Schs #define ATTR_REAL 0x10 /* yield attributes of the real vp */ 419*ba2539a9Schs #define ATTR_NOACLCHECK 0x20 /* Don't check ACL when checking permissions */ 420*ba2539a9Schs #define ATTR_TRIGGER 0x40 /* Mount first if vnode is a trigger mount */ 421*ba2539a9Schs 422*ba2539a9Schs #ifdef __cplusplus 423*ba2539a9Schs } 424*ba2539a9Schs #endif 425*ba2539a9Schs 426*ba2539a9Schs #endif /* _UTS_SYS_VNODE_H */ 427