diff options
Diffstat (limited to 'usr/src/uts/common/sys/vnode.h')
-rw-r--r-- | usr/src/uts/common/sys/vnode.h | 681 |
1 files changed, 494 insertions, 187 deletions
diff --git a/usr/src/uts/common/sys/vnode.h b/usr/src/uts/common/sys/vnode.h index 56f4ac42d8..3195fb4ebd 100644 --- a/usr/src/uts/common/sys/vnode.h +++ b/usr/src/uts/common/sys/vnode.h @@ -194,6 +194,7 @@ struct vsd_node { * v_shrlocks * v_path * v_vsd + * v_xattrdir * * A special lock (implemented by vn_vfswlock in vnode.c) protects: * v_vfsmountedhere @@ -262,6 +263,7 @@ typedef struct vnode { krwlock_t v_mslock; /* protects v_mset */ void *v_fopdata; /* list of file ops event watches */ struct vsd_node *v_vsd; /* vnode specific data */ + struct vnode *v_xattrdir; /* unnamed extended attr dir (GFS) */ } vnode_t; #define IS_DEVVP(vp) \ @@ -334,6 +336,8 @@ typedef struct vn_vfslocks_entry { #define VISSWAPFS 0x20000 /* vnode is being used for swapfs */ #define IS_SWAPFSVP(vp) (((vp)->v_flag & VISSWAPFS) != 0) +#define V_SYSATTR 0x40000 /* vnode is a GFS system attribute */ + /* * Vnode attributes. A bit-mask is supplied as part of the * structure to indicate the attributes the caller wants to @@ -366,6 +370,101 @@ typedef struct vattr { uint_t va_seq; /* sequence number */ } vattr_t; +#define AV_SCANSTAMP_SZ 32 /* length of anti-virus scanstamp */ + +/* + * Structure of all optional attributes. + */ +typedef struct xoptattr { + timestruc_t xoa_createtime; /* Create time of file */ + uint8_t xoa_archive; + uint8_t xoa_system; + uint8_t xoa_readonly; + uint8_t xoa_hidden; + uint8_t xoa_nounlink; + uint8_t xoa_immutable; + uint8_t xoa_appendonly; + uint8_t xoa_nodump; + uint8_t xoa_opaque; + uint8_t xoa_av_quarantined; + uint8_t xoa_av_modified; + uint8_t xoa_av_scanstamp[AV_SCANSTAMP_SZ]; +} xoptattr_t; + +/* + * The xvattr structure is really a variable length structure that + * is made up of: + * - The classic vattr_t (xva_vattr) + * - a 32 bit quantity (xva_mapsize) that specifies the size of the + * attribute bitmaps in 32 bit words. + * - A pointer to the returned attribute bitmap (needed because the + * previous element, the requested attribute bitmap) is variable lenth. + * - The requested attribute bitmap, which is an array of 32 bit words. + * Callers use the XVA_SET_REQ() macro to set the bits corresponding to + * the attributes that are being requested. + * - The returned attribute bitmap, which is an array of 32 bit words. + * File systems that support optional attributes use the XVA_SET_RTN() + * macro to set the bits corresponding to the attributes that are being + * returned. + * - The xoptattr_t structure which contains the attribute values + * + * xva_mapsize determines how many words in the attribute bitmaps. + * Immediately following the attribute bitmaps is the xoptattr_t. + * xva_getxoptattr() is used to get the pointer to the xoptattr_t + * section. + */ + +#define XVA_MAPSIZE 3 /* Size of attr bitmaps */ +#define XVA_MAGIC 0x78766174 /* Magic # for verification */ + +/* + * The xvattr structure is an extensible structure which permits optional + * attributes to be requested/returned. File systems may or may not support + * optional attributes. They do so at their own discretion but if they do + * support optional attributes, they must register the VFSFT_XVATTR feature + * so that the optional attributes can be set/retrived. + * + * The fields of the xvattr structure are: + * + * xva_vattr - The first element of an xvattr is a legacy vattr structure + * which includes the common attributes. If AT_XVATTR is set in the va_mask + * then the entire structure is treated as an xvattr. If AT_XVATTR is not + * set, then only the xva_vattr structure can be used. + * + * xva_magic - 0x78766174 (hex for "xvat"). Magic number for verification. + * + * xva_mapsize - Size of requested and returned attribute bitmaps. + * + * xva_rtnattrmapp - Pointer to xva_rtnattrmap[]. We need this since the + * size of the array before it, xva_reqattrmap[], could change which means + * the location of xva_rtnattrmap[] could change. This will allow unbundled + * file systems to find the location of xva_rtnattrmap[] when the sizes change. + * + * xva_reqattrmap[] - Array of requested attributes. Attributes are + * represented by a specific bit in a specific element of the attribute + * map array. Callers set the bits corresponding to the attributes + * that the caller wants to get/set. + * + * xva_rtnattrmap[] - Array of attributes that the file system was able to + * process. Not all file systems support all optional attributes. This map + * informs the caller which attributes the underlying file system was able + * to set/get. (Same structure as the requested attributes array in terms + * of each attribute corresponding to specific bits and array elements.) + * + * xva_xoptattrs - Structure containing values of optional attributes. + * These values are only valid if the corresponding bits in xva_reqattrmap + * are set and the underlying file system supports those attributes. + */ +typedef struct xvattr { + vattr_t xva_vattr; /* Embedded vattr structure */ + uint32_t xva_magic; /* Magic Number */ + uint32_t xva_mapsize; /* Size of attr bitmap (32-bit words) */ + uint32_t *xva_rtnattrmapp; /* Ptr to xva_rtnattrmap[] */ + uint32_t xva_reqattrmap[XVA_MAPSIZE]; /* Requested attrs */ + uint32_t xva_rtnattrmap[XVA_MAPSIZE]; /* Returned attrs */ + xoptattr_t xva_xoptattrs; /* Optional attributes */ +} xvattr_t; + #ifdef _SYSCALL32 /* * For bigtypes time_t changed to 64 bit on the 64-bit kernel. @@ -407,22 +506,29 @@ typedef vattr_t vattr32_t; /* * Attributes of interest to the caller of setattr or getattr. */ -#define AT_TYPE 0x0001 -#define AT_MODE 0x0002 -#define AT_UID 0x0004 -#define AT_GID 0x0008 -#define AT_FSID 0x0010 -#define AT_NODEID 0x0020 -#define AT_NLINK 0x0040 -#define AT_SIZE 0x0080 -#define AT_ATIME 0x0100 -#define AT_MTIME 0x0200 -#define AT_CTIME 0x0400 -#define AT_RDEV 0x0800 -#define AT_BLKSIZE 0x1000 -#define AT_NBLOCKS 0x2000 -/* 0x4000 */ /* unused */ -#define AT_SEQ 0x8000 +#define AT_TYPE 0x00001 +#define AT_MODE 0x00002 +#define AT_UID 0x00004 +#define AT_GID 0x00008 +#define AT_FSID 0x00010 +#define AT_NODEID 0x00020 +#define AT_NLINK 0x00040 +#define AT_SIZE 0x00080 +#define AT_ATIME 0x00100 +#define AT_MTIME 0x00200 +#define AT_CTIME 0x00400 +#define AT_RDEV 0x00800 +#define AT_BLKSIZE 0x01000 +#define AT_NBLOCKS 0x02000 +/* 0x04000 */ /* unused */ +#define AT_SEQ 0x08000 +/* + * If AT_XVATTR is set then there are additional bits to process in + * the xvattr_t's attribute bitmap. If this is not set then the bitmap + * MUST be ignored. Note that this bit must be set/cleared explicitly. + * That is, setting AT_ALL will NOT set AT_XVATTR. + */ +#define AT_XVATTR 0x10000 #define AT_ALL (AT_TYPE|AT_MODE|AT_UID|AT_GID|AT_FSID|AT_NODEID|\ AT_NLINK|AT_SIZE|AT_ATIME|AT_MTIME|AT_CTIME|\ @@ -437,6 +543,116 @@ typedef vattr_t vattr32_t; AT_BLKSIZE|AT_NBLOCKS|AT_SEQ) /* + * Attribute bits used in the extensible attribute's (xva's) attribute + * bitmaps. Note that the bitmaps are made up of a variable length number + * of 32-bit words. The convention is to use XAT{n}_{attrname} where "n" + * is the element in the bitmap (starting at 1). This convention is for + * the convenience of the maintainer to keep track of which element each + * attribute belongs to. + * + * NOTE THAT CONSUMERS MUST *NOT* USE THE XATn_* DEFINES DIRECTLY. CONSUMERS + * MUST USE THE XAT_* DEFINES. + */ +#define XAT0_INDEX 0LL /* Index into bitmap for XAT0 attrs */ +#define XAT0_CREATETIME 0x00000001 /* Create time of file */ +#define XAT0_ARCHIVE 0x00000002 /* Archive */ +#define XAT0_SYSTEM 0x00000004 /* System */ +#define XAT0_READONLY 0x00000008 /* Readonly */ +#define XAT0_HIDDEN 0x00000010 /* Hidden */ +#define XAT0_NOUNLINK 0x00000020 /* Nounlink */ +#define XAT0_IMMUTABLE 0x00000040 /* immutable */ +#define XAT0_APPENDONLY 0x00000080 /* appendonly */ +#define XAT0_NODUMP 0x00000100 /* nodump */ +#define XAT0_OPAQUE 0x00000200 /* opaque */ +#define XAT0_AV_QUARANTINED 0x00000400 /* anti-virus quarantine */ +#define XAT0_AV_MODIFIED 0x00000800 /* anti-virus modified */ +#define XAT0_AV_SCANSTAMP 0x00001000 /* anti-virus scanstamp */ + +#define XAT0_ALL_ATTRS (XAT0_CREATETIME|XAT0_ARCHIVE|XAT0_SYSTEM| \ + XAT0_READONLY|XAT0_HIDDEN|XAT0_NOUNLINK|XAT0_IMMUTABLE|XAT0_APPENDONLY| \ + XAT0_NODUMP|XAT0_OPAQUE|XAT0_AV_QUARANTINED| \ + XAT0_AV_MODIFIED|XAT0_AV_SCANSTAMP) + +/* Support for XAT_* optional attributes */ +#define XVA_MASK 0xffffffff /* Used to mask off 32 bits */ +#define XVA_SHFT 32 /* Used to shift index */ + +/* + * Used to pry out the index and attribute bits from the XAT_* attributes + * defined below. Note that we're masking things down to 32 bits then + * casting to uint32_t. + */ +#define XVA_INDEX(attr) ((uint32_t)(((attr) >> XVA_SHFT) & XVA_MASK)) +#define XVA_ATTRBIT(attr) ((uint32_t)((attr) & XVA_MASK)) + +/* + * The following defines present a "flat namespace" so that consumers don't + * need to keep track of which element belongs to which bitmap entry. + * + * NOTE THAT THESE MUST NEVER BE OR-ed TOGETHER + */ +#define XAT_CREATETIME ((XAT0_INDEX << XVA_SHFT) | XAT0_CREATETIME) +#define XAT_ARCHIVE ((XAT0_INDEX << XVA_SHFT) | XAT0_ARCHIVE) +#define XAT_SYSTEM ((XAT0_INDEX << XVA_SHFT) | XAT0_SYSTEM) +#define XAT_READONLY ((XAT0_INDEX << XVA_SHFT) | XAT0_READONLY) +#define XAT_HIDDEN ((XAT0_INDEX << XVA_SHFT) | XAT0_HIDDEN) +#define XAT_NOUNLINK ((XAT0_INDEX << XVA_SHFT) | XAT0_NOUNLINK) +#define XAT_IMMUTABLE ((XAT0_INDEX << XVA_SHFT) | XAT0_IMMUTABLE) +#define XAT_APPENDONLY ((XAT0_INDEX << XVA_SHFT) | XAT0_APPENDONLY) +#define XAT_NODUMP ((XAT0_INDEX << XVA_SHFT) | XAT0_NODUMP) +#define XAT_OPAQUE ((XAT0_INDEX << XVA_SHFT) | XAT0_OPAQUE) +#define XAT_AV_QUARANTINED ((XAT0_INDEX << XVA_SHFT) | XAT0_AV_QUARANTINED) +#define XAT_AV_MODIFIED ((XAT0_INDEX << XVA_SHFT) | XAT0_AV_MODIFIED) +#define XAT_AV_SCANSTAMP ((XAT0_INDEX << XVA_SHFT) | XAT0_AV_SCANSTAMP) + +/* + * The returned attribute map array (xva_rtnattrmap[]) is located past the + * requested attribute map array (xva_reqattrmap[]). Its location changes + * when the array sizes change. We use a separate pointer in a known location + * (xva_rtnattrmapp) to hold the location of xva_rtnattrmap[]. This is + * set in xva_init() + */ +#define XVA_RTNATTRMAP(xvap) ((xvap)->xva_rtnattrmapp) + +/* + * XVA_SET_REQ() sets an attribute bit in the proper element in the bitmap + * of requested attributes (xva_reqattrmap[]). + */ +#define XVA_SET_REQ(xvap, attr) \ + ASSERT((xvap)->xva_vattr.va_mask | AT_XVATTR); \ + ASSERT((xvap)->xva_magic == XVA_MAGIC); \ + (xvap)->xva_reqattrmap[XVA_INDEX(attr)] |= XVA_ATTRBIT(attr) + +/* + * XVA_SET_RTN() sets an attribute bit in the proper element in the bitmap + * of returned attributes (xva_rtnattrmap[]). + */ +#define XVA_SET_RTN(xvap, attr) \ + ASSERT((xvap)->xva_vattr.va_mask | AT_XVATTR); \ + ASSERT((xvap)->xva_magic == XVA_MAGIC); \ + (XVA_RTNATTRMAP(xvap))[XVA_INDEX(attr)] |= XVA_ATTRBIT(attr) + +/* + * XVA_ISSET_REQ() checks the requested attribute bitmap (xva_reqattrmap[]) + * to see of the corresponding attribute bit is set. If so, returns non-zero. + */ +#define XVA_ISSET_REQ(xvap, attr) \ + ((((xvap)->xva_vattr.va_mask | AT_XVATTR) && \ + ((xvap)->xva_magic == XVA_MAGIC) && \ + ((xvap)->xva_mapsize > XVA_INDEX(attr))) ? \ + ((xvap)->xva_reqattrmap[XVA_INDEX(attr)] & XVA_ATTRBIT(attr)) : 0) + +/* + * XVA_ISSET_RTN() checks the returned attribute bitmap (xva_rtnattrmap[]) + * to see of the corresponding attribute bit is set. If so, returns non-zero. + */ +#define XVA_ISSET_RTN(xvap, attr) \ + ((((xvap)->xva_vattr.va_mask | AT_XVATTR) && \ + ((xvap)->xva_magic == XVA_MAGIC) && \ + ((xvap)->xva_mapsize > XVA_INDEX(attr))) ? \ + ((XVA_RTNATTRMAP(xvap))[XVA_INDEX(attr)] & XVA_ATTRBIT(attr)) : 0) + +/* * Modes. Some values same as S_xxx entries from stat.h for convenience. */ #define VSUID 04000 /* set user id on execution */ @@ -454,6 +670,12 @@ typedef vattr_t vattr32_t; #define PERMMASK 00777 /* permission bits */ /* + * VOP_ACCESS flags + */ +#define V_ACE_MASK 0x1 /* mask represents NFSv4 ACE permissions */ +#define V_APPEND 0x2 /* want to do append only check */ + +/* * Check whether mandatory file locking is enabled. */ @@ -506,15 +728,19 @@ typedef struct vsecattr { void *vsa_aclentp; /* pointer to ACL entries */ int vsa_dfaclcnt; /* default ACL entry count */ void *vsa_dfaclentp; /* pointer to default ACL entries */ + size_t vsa_aclentsz; /* ACE size in bytes of vsa_aclentp */ + uint_t vsa_aclflags; /* ACE ACL flags */ } vsecattr_t; /* vsa_mask values */ -#define VSA_ACL 0x0001 -#define VSA_ACLCNT 0x0002 -#define VSA_DFACL 0x0004 -#define VSA_DFACLCNT 0x0008 -#define VSA_ACE 0x0010 -#define VSA_ACECNT 0x0020 +#define VSA_ACL 0x0001 +#define VSA_ACLCNT 0x0002 +#define VSA_DFACL 0x0004 +#define VSA_DFACLCNT 0x0008 +#define VSA_ACE 0x0010 +#define VSA_ACECNT 0x0020 +#define VSA_ACE_ALLTYPES 0x0040 +#define VSA_ACE_ACLFLAGS 0x0080 /* get/set ACE ACL flags */ /* * Structure used by various vnode operations to determine @@ -552,79 +778,110 @@ struct pollhead; * the vnodeops structure (below) and the fs_func_p union (vfs_opreg.h). */ #define VNODE_OPS \ - int (*vop_open)(vnode_t **, int, cred_t *); \ - int (*vop_close)(vnode_t *, int, int, offset_t, cred_t *); \ + int (*vop_open)(vnode_t **, int, cred_t *, \ + caller_context_t *); \ + int (*vop_close)(vnode_t *, int, int, offset_t, cred_t *, \ + caller_context_t *); \ int (*vop_read)(vnode_t *, uio_t *, int, cred_t *, \ caller_context_t *); \ int (*vop_write)(vnode_t *, uio_t *, int, cred_t *, \ caller_context_t *); \ int (*vop_ioctl)(vnode_t *, int, intptr_t, int, cred_t *, \ - int *); \ - int (*vop_setfl)(vnode_t *, int, int, cred_t *); \ - int (*vop_getattr)(vnode_t *, vattr_t *, int, cred_t *); \ + int *, caller_context_t *); \ + int (*vop_setfl)(vnode_t *, int, int, cred_t *, \ + caller_context_t *); \ + int (*vop_getattr)(vnode_t *, vattr_t *, int, cred_t *, \ + caller_context_t *); \ int (*vop_setattr)(vnode_t *, vattr_t *, int, cred_t *, \ caller_context_t *); \ - int (*vop_access)(vnode_t *, int, int, cred_t *); \ + int (*vop_access)(vnode_t *, int, int, cred_t *, \ + caller_context_t *); \ int (*vop_lookup)(vnode_t *, char *, vnode_t **, \ struct pathname *, \ - int, vnode_t *, cred_t *); \ + int, vnode_t *, cred_t *, \ + caller_context_t *, int *, \ + struct pathname *); \ int (*vop_create)(vnode_t *, char *, vattr_t *, vcexcl_t, \ - int, vnode_t **, cred_t *, int); \ - int (*vop_remove)(vnode_t *, char *, cred_t *); \ - int (*vop_link)(vnode_t *, vnode_t *, char *, cred_t *); \ + int, vnode_t **, cred_t *, int, \ + caller_context_t *, vsecattr_t *); \ + int (*vop_remove)(vnode_t *, char *, cred_t *, \ + caller_context_t *, int); \ + int (*vop_link)(vnode_t *, vnode_t *, char *, cred_t *, \ + caller_context_t *, int); \ int (*vop_rename)(vnode_t *, char *, vnode_t *, char *, \ - cred_t *); \ + cred_t *, caller_context_t *, int); \ int (*vop_mkdir)(vnode_t *, char *, vattr_t *, vnode_t **, \ - cred_t *); \ - int (*vop_rmdir)(vnode_t *, char *, vnode_t *, cred_t *); \ - int (*vop_readdir)(vnode_t *, uio_t *, cred_t *, int *); \ + cred_t *, caller_context_t *, int, \ + vsecattr_t *); \ + int (*vop_rmdir)(vnode_t *, char *, vnode_t *, cred_t *, \ + caller_context_t *, int); \ + int (*vop_readdir)(vnode_t *, uio_t *, cred_t *, int *, \ + caller_context_t *, int); \ int (*vop_symlink)(vnode_t *, char *, vattr_t *, char *, \ - cred_t *); \ - int (*vop_readlink)(vnode_t *, uio_t *, cred_t *); \ - int (*vop_fsync)(vnode_t *, int, cred_t *); \ - void (*vop_inactive)(vnode_t *, cred_t *); \ - int (*vop_fid)(vnode_t *, struct fid *); \ + cred_t *, caller_context_t *, int); \ + int (*vop_readlink)(vnode_t *, uio_t *, cred_t *, \ + caller_context_t *); \ + int (*vop_fsync)(vnode_t *, int, cred_t *, \ + caller_context_t *); \ + void (*vop_inactive)(vnode_t *, cred_t *, \ + caller_context_t *); \ + int (*vop_fid)(vnode_t *, struct fid *, \ + caller_context_t *); \ int (*vop_rwlock)(vnode_t *, int, caller_context_t *); \ void (*vop_rwunlock)(vnode_t *, int, caller_context_t *); \ - int (*vop_seek)(vnode_t *, offset_t, offset_t *); \ - int (*vop_cmp)(vnode_t *, vnode_t *); \ + int (*vop_seek)(vnode_t *, offset_t, offset_t *, \ + caller_context_t *); \ + int (*vop_cmp)(vnode_t *, vnode_t *, caller_context_t *); \ int (*vop_frlock)(vnode_t *, int, struct flock64 *, \ int, offset_t, \ - struct flk_callback *, cred_t *); \ + struct flk_callback *, cred_t *, \ + caller_context_t *); \ int (*vop_space)(vnode_t *, int, struct flock64 *, \ int, offset_t, \ cred_t *, caller_context_t *); \ - int (*vop_realvp)(vnode_t *, vnode_t **); \ + int (*vop_realvp)(vnode_t *, vnode_t **, \ + caller_context_t *); \ int (*vop_getpage)(vnode_t *, offset_t, size_t, uint_t *, \ struct page **, size_t, struct seg *, \ - caddr_t, enum seg_rw, cred_t *); \ + caddr_t, enum seg_rw, cred_t *, \ + caller_context_t *); \ int (*vop_putpage)(vnode_t *, offset_t, size_t, \ - int, cred_t *); \ + int, cred_t *, caller_context_t *); \ int (*vop_map)(vnode_t *, offset_t, struct as *, \ caddr_t *, size_t, \ - uchar_t, uchar_t, uint_t, cred_t *); \ + uchar_t, uchar_t, uint_t, cred_t *, \ + caller_context_t *); \ int (*vop_addmap)(vnode_t *, offset_t, struct as *, \ caddr_t, size_t, \ - uchar_t, uchar_t, uint_t, cred_t *); \ + uchar_t, uchar_t, uint_t, cred_t *, \ + caller_context_t *); \ int (*vop_delmap)(vnode_t *, offset_t, struct as *, \ caddr_t, size_t, \ - uint_t, uint_t, uint_t, cred_t *); \ + uint_t, uint_t, uint_t, cred_t *, \ + caller_context_t *); \ int (*vop_poll)(vnode_t *, short, int, short *, \ - struct pollhead **); \ - int (*vop_dump)(vnode_t *, caddr_t, int, int); \ - int (*vop_pathconf)(vnode_t *, int, ulong_t *, cred_t *); \ + struct pollhead **, \ + caller_context_t *); \ + int (*vop_dump)(vnode_t *, caddr_t, int, int, \ + caller_context_t *); \ + int (*vop_pathconf)(vnode_t *, int, ulong_t *, cred_t *, \ + caller_context_t *); \ int (*vop_pageio)(vnode_t *, struct page *, \ - u_offset_t, size_t, int, cred_t *); \ - int (*vop_dumpctl)(vnode_t *, int, int *); \ + u_offset_t, size_t, int, cred_t *, \ + caller_context_t *); \ + int (*vop_dumpctl)(vnode_t *, int, int *, \ + caller_context_t *); \ void (*vop_dispose)(vnode_t *, struct page *, \ - int, int, cred_t *); \ + int, int, cred_t *, \ + caller_context_t *); \ int (*vop_setsecattr)(vnode_t *, vsecattr_t *, \ - int, cred_t *); \ + int, cred_t *, caller_context_t *); \ int (*vop_getsecattr)(vnode_t *, vsecattr_t *, \ - int, cred_t *); \ + int, cred_t *, caller_context_t *); \ int (*vop_shrlock)(vnode_t *, int, struct shrlock *, \ - int, cred_t *); \ - int (*vop_vnevent)(vnode_t *, vnevent_t, vnode_t *, char *) \ + int, cred_t *, caller_context_t *); \ + int (*vop_vnevent)(vnode_t *, vnevent_t, vnode_t *, \ + char *, caller_context_t *) /* NB: No ";" */ /* @@ -639,153 +896,178 @@ typedef struct vnodeops { typedef int (*fs_generic_func_p) (); /* Generic vop/vfsop/femop/fsemop ptr */ -extern int fop_open(vnode_t **, int, cred_t *); -extern int fop_close(vnode_t *, int, int, offset_t, cred_t *); +extern int fop_open(vnode_t **, int, cred_t *, caller_context_t *); +extern int fop_close(vnode_t *, int, int, offset_t, cred_t *, + caller_context_t *); extern int fop_read(vnode_t *, uio_t *, int, cred_t *, caller_context_t *); extern int fop_write(vnode_t *, uio_t *, int, cred_t *, caller_context_t *); -extern int fop_ioctl(vnode_t *, int, intptr_t, int, cred_t *, int *); -extern int fop_setfl(vnode_t *, int, int, cred_t *); -extern int fop_getattr(vnode_t *, vattr_t *, int, cred_t *); +extern int fop_ioctl(vnode_t *, int, intptr_t, int, cred_t *, int *, + caller_context_t *); +extern int fop_setfl(vnode_t *, int, int, cred_t *, caller_context_t *); +extern int fop_getattr(vnode_t *, vattr_t *, int, cred_t *, + caller_context_t *); extern int fop_setattr(vnode_t *, vattr_t *, int, cred_t *, caller_context_t *); -extern int fop_access(vnode_t *, int, int, cred_t *); +extern int fop_access(vnode_t *, int, int, cred_t *, caller_context_t *); extern int fop_lookup(vnode_t *, char *, vnode_t **, struct pathname *, - int, vnode_t *, cred_t *); + int, vnode_t *, cred_t *, caller_context_t *, + int *, struct pathname *); extern int fop_create(vnode_t *, char *, vattr_t *, vcexcl_t, int, - vnode_t **, cred_t *, int); -extern int fop_remove(vnode_t *vp, char *, cred_t *); -extern int fop_link(vnode_t *, vnode_t *, char *, cred_t *); -extern int fop_rename(vnode_t *, char *, vnode_t *, char *, cred_t *); -extern int fop_mkdir(vnode_t *, char *, vattr_t *, vnode_t **, cred_t *); -extern int fop_rmdir(vnode_t *, char *, vnode_t *, cred_t *); -extern int fop_readdir(vnode_t *, uio_t *, cred_t *, int *); -extern int fop_symlink(vnode_t *, char *, vattr_t *, char *, cred_t *); -extern int fop_readlink(vnode_t *, uio_t *, cred_t *); -extern int fop_fsync(vnode_t *, int, cred_t *); -extern void fop_inactive(vnode_t *, cred_t *); -extern int fop_fid(vnode_t *, struct fid *); + vnode_t **, cred_t *, int, caller_context_t *, + vsecattr_t *); +extern int fop_remove(vnode_t *vp, char *, cred_t *, caller_context_t *, + int); +extern int fop_link(vnode_t *, vnode_t *, char *, cred_t *, + caller_context_t *, int); +extern int fop_rename(vnode_t *, char *, vnode_t *, char *, cred_t *, + caller_context_t *, int); +extern int fop_mkdir(vnode_t *, char *, vattr_t *, vnode_t **, cred_t *, + caller_context_t *, int, vsecattr_t *); +extern int fop_rmdir(vnode_t *, char *, vnode_t *, cred_t *, + caller_context_t *, int); +extern int fop_readdir(vnode_t *, uio_t *, cred_t *, int *, + caller_context_t *, int); +extern int fop_symlink(vnode_t *, char *, vattr_t *, char *, cred_t *, + caller_context_t *, int); +extern int fop_readlink(vnode_t *, uio_t *, cred_t *, caller_context_t *); +extern int fop_fsync(vnode_t *, int, cred_t *, caller_context_t *); +extern void fop_inactive(vnode_t *, cred_t *, caller_context_t *); +extern int fop_fid(vnode_t *, struct fid *, caller_context_t *); extern int fop_rwlock(vnode_t *, int, caller_context_t *); extern void fop_rwunlock(vnode_t *, int, caller_context_t *); -extern int fop_seek(vnode_t *, offset_t, offset_t *); -extern int fop_cmp(vnode_t *, vnode_t *); +extern int fop_seek(vnode_t *, offset_t, offset_t *, caller_context_t *); +extern int fop_cmp(vnode_t *, vnode_t *, caller_context_t *); extern int fop_frlock(vnode_t *, int, struct flock64 *, int, offset_t, - struct flk_callback *, cred_t *); + struct flk_callback *, cred_t *, + caller_context_t *); extern int fop_space(vnode_t *, int, struct flock64 *, int, offset_t, cred_t *, caller_context_t *); -extern int fop_realvp(vnode_t *, vnode_t **); +extern int fop_realvp(vnode_t *, vnode_t **, caller_context_t *); extern int fop_getpage(vnode_t *, offset_t, size_t, uint_t *, struct page **, size_t, struct seg *, - caddr_t, enum seg_rw, cred_t *); -extern int fop_putpage(vnode_t *, offset_t, size_t, int, cred_t *); + caddr_t, enum seg_rw, cred_t *, + caller_context_t *); +extern int fop_putpage(vnode_t *, offset_t, size_t, int, cred_t *, + caller_context_t *); extern int fop_map(vnode_t *, offset_t, struct as *, caddr_t *, size_t, - uchar_t, uchar_t, uint_t, cred_t *cr); + uchar_t, uchar_t, uint_t, cred_t *cr, + caller_context_t *); extern int fop_addmap(vnode_t *, offset_t, struct as *, caddr_t, size_t, - uchar_t, uchar_t, uint_t, cred_t *); + uchar_t, uchar_t, uint_t, cred_t *, + caller_context_t *); extern int fop_delmap(vnode_t *, offset_t, struct as *, caddr_t, size_t, - uint_t, uint_t, uint_t, cred_t *); -extern int fop_poll(vnode_t *, short, int, short *, struct pollhead **); -extern int fop_dump(vnode_t *, caddr_t, int, int); -extern int fop_pathconf(vnode_t *, int, ulong_t *, cred_t *); + uint_t, uint_t, uint_t, cred_t *, + caller_context_t *); +extern int fop_poll(vnode_t *, short, int, short *, struct pollhead **, + caller_context_t *); +extern int fop_dump(vnode_t *, caddr_t, int, int, caller_context_t *); +extern int fop_pathconf(vnode_t *, int, ulong_t *, cred_t *, + caller_context_t *); extern int fop_pageio(vnode_t *, struct page *, u_offset_t, size_t, int, - cred_t *); -extern int fop_dumpctl(vnode_t *, int, int *); -extern void fop_dispose(vnode_t *, struct page *, int, int, cred_t *); -extern int fop_setsecattr(vnode_t *, vsecattr_t *, int, cred_t *); -extern int fop_getsecattr(vnode_t *, vsecattr_t *, int, cred_t *); -extern int fop_shrlock(vnode_t *, int, struct shrlock *, int, cred_t *); -extern int fop_vnevent(vnode_t *, vnevent_t, vnode_t *, char *); + cred_t *, caller_context_t *); +extern int fop_dumpctl(vnode_t *, int, int *, caller_context_t *); +extern void fop_dispose(vnode_t *, struct page *, int, int, cred_t *, + caller_context_t *); +extern int fop_setsecattr(vnode_t *, vsecattr_t *, int, cred_t *, + caller_context_t *); +extern int fop_getsecattr(vnode_t *, vsecattr_t *, int, cred_t *, + caller_context_t *); +extern int fop_shrlock(vnode_t *, int, struct shrlock *, int, cred_t *, + caller_context_t *); +extern int fop_vnevent(vnode_t *, vnevent_t, vnode_t *, char *, + caller_context_t *); #endif /* _KERNEL */ -#define VOP_OPEN(vpp, mode, cr) \ - fop_open(vpp, mode, cr) -#define VOP_CLOSE(vp, f, c, o, cr) \ - fop_close(vp, f, c, o, cr) +#define VOP_OPEN(vpp, mode, cr, ct) \ + fop_open(vpp, mode, cr, ct) +#define VOP_CLOSE(vp, f, c, o, cr, ct) \ + fop_close(vp, f, c, o, cr, ct) #define VOP_READ(vp, uiop, iof, cr, ct) \ fop_read(vp, uiop, iof, cr, ct) #define VOP_WRITE(vp, uiop, iof, cr, ct) \ fop_write(vp, uiop, iof, cr, ct) -#define VOP_IOCTL(vp, cmd, a, f, cr, rvp) \ - fop_ioctl(vp, cmd, a, f, cr, rvp) -#define VOP_SETFL(vp, f, a, cr) \ - fop_setfl(vp, f, a, cr) -#define VOP_GETATTR(vp, vap, f, cr) \ - fop_getattr(vp, vap, f, cr) +#define VOP_IOCTL(vp, cmd, a, f, cr, rvp, ct) \ + fop_ioctl(vp, cmd, a, f, cr, rvp, ct) +#define VOP_SETFL(vp, f, a, cr, ct) \ + fop_setfl(vp, f, a, cr, ct) +#define VOP_GETATTR(vp, vap, f, cr, ct) \ + fop_getattr(vp, vap, f, cr, ct) #define VOP_SETATTR(vp, vap, f, cr, ct) \ fop_setattr(vp, vap, f, cr, ct) -#define VOP_ACCESS(vp, mode, f, cr) \ - fop_access(vp, mode, f, cr) -#define VOP_LOOKUP(vp, cp, vpp, pnp, f, rdir, cr) \ - fop_lookup(vp, cp, vpp, pnp, f, rdir, cr) -#define VOP_CREATE(dvp, p, vap, ex, mode, vpp, cr, flag) \ - fop_create(dvp, p, vap, ex, mode, vpp, cr, flag) -#define VOP_REMOVE(dvp, p, cr) \ - fop_remove(dvp, p, cr) -#define VOP_LINK(tdvp, fvp, p, cr) \ - fop_link(tdvp, fvp, p, cr) -#define VOP_RENAME(fvp, fnm, tdvp, tnm, cr) \ - fop_rename(fvp, fnm, tdvp, tnm, cr) -#define VOP_MKDIR(dp, p, vap, vpp, cr) \ - fop_mkdir(dp, p, vap, vpp, cr) -#define VOP_RMDIR(dp, p, cdir, cr) \ - fop_rmdir(dp, p, cdir, cr) -#define VOP_READDIR(vp, uiop, cr, eofp) \ - fop_readdir(vp, uiop, cr, eofp) -#define VOP_SYMLINK(dvp, lnm, vap, tnm, cr) \ - fop_symlink(dvp, lnm, vap, tnm, cr) -#define VOP_READLINK(vp, uiop, cr) \ - fop_readlink(vp, uiop, cr) -#define VOP_FSYNC(vp, syncflag, cr) \ - fop_fsync(vp, syncflag, cr) -#define VOP_INACTIVE(vp, cr) \ - fop_inactive(vp, cr) -#define VOP_FID(vp, fidp) \ - fop_fid(vp, fidp) +#define VOP_ACCESS(vp, mode, f, cr, ct) \ + fop_access(vp, mode, f, cr, ct) +#define VOP_LOOKUP(vp, cp, vpp, pnp, f, rdir, cr, ct, defp, rpnp) \ + fop_lookup(vp, cp, vpp, pnp, f, rdir, cr, ct, defp, rpnp) +#define VOP_CREATE(dvp, p, vap, ex, mode, vpp, cr, flag, ct, vsap) \ + fop_create(dvp, p, vap, ex, mode, vpp, cr, flag, ct, vsap) +#define VOP_REMOVE(dvp, p, cr, ct, f) \ + fop_remove(dvp, p, cr, ct, f) +#define VOP_LINK(tdvp, fvp, p, cr, ct, f) \ + fop_link(tdvp, fvp, p, cr, ct, f) +#define VOP_RENAME(fvp, fnm, tdvp, tnm, cr, ct, f) \ + fop_rename(fvp, fnm, tdvp, tnm, cr, ct, f) +#define VOP_MKDIR(dp, p, vap, vpp, cr, ct, f, vsap) \ + fop_mkdir(dp, p, vap, vpp, cr, ct, f, vsap) +#define VOP_RMDIR(dp, p, cdir, cr, ct, f) \ + fop_rmdir(dp, p, cdir, cr, ct, f) +#define VOP_READDIR(vp, uiop, cr, eofp, ct, f) \ + fop_readdir(vp, uiop, cr, eofp, ct, f) +#define VOP_SYMLINK(dvp, lnm, vap, tnm, cr, ct, f) \ + fop_symlink(dvp, lnm, vap, tnm, cr, ct, f) +#define VOP_READLINK(vp, uiop, cr, ct) \ + fop_readlink(vp, uiop, cr, ct) +#define VOP_FSYNC(vp, syncflag, cr, ct) \ + fop_fsync(vp, syncflag, cr, ct) +#define VOP_INACTIVE(vp, cr, ct) \ + fop_inactive(vp, cr, ct) +#define VOP_FID(vp, fidp, ct) \ + fop_fid(vp, fidp, ct) #define VOP_RWLOCK(vp, w, ct) \ fop_rwlock(vp, w, ct) #define VOP_RWUNLOCK(vp, w, ct) \ fop_rwunlock(vp, w, ct) -#define VOP_SEEK(vp, ooff, noffp) \ - fop_seek(vp, ooff, noffp) -#define VOP_CMP(vp1, vp2) \ - fop_cmp(vp1, vp2) -#define VOP_FRLOCK(vp, cmd, a, f, o, cb, cr) \ - fop_frlock(vp, cmd, a, f, o, cb, cr) +#define VOP_SEEK(vp, ooff, noffp, ct) \ + fop_seek(vp, ooff, noffp, ct) +#define VOP_CMP(vp1, vp2, ct) \ + fop_cmp(vp1, vp2, ct) +#define VOP_FRLOCK(vp, cmd, a, f, o, cb, cr, ct) \ + fop_frlock(vp, cmd, a, f, o, cb, cr, ct) #define VOP_SPACE(vp, cmd, a, f, o, cr, ct) \ fop_space(vp, cmd, a, f, o, cr, ct) -#define VOP_REALVP(vp1, vp2) \ - fop_realvp(vp1, vp2) -#define VOP_GETPAGE(vp, of, sz, pr, pl, ps, sg, a, rw, cr) \ - fop_getpage(vp, of, sz, pr, pl, ps, sg, a, rw, cr) -#define VOP_PUTPAGE(vp, of, sz, fl, cr) \ - fop_putpage(vp, of, sz, fl, cr) -#define VOP_MAP(vp, of, as, a, sz, p, mp, fl, cr) \ - fop_map(vp, of, as, a, sz, p, mp, fl, cr) -#define VOP_ADDMAP(vp, of, as, a, sz, p, mp, fl, cr) \ - fop_addmap(vp, of, as, a, sz, p, mp, fl, cr) -#define VOP_DELMAP(vp, of, as, a, sz, p, mp, fl, cr) \ - fop_delmap(vp, of, as, a, sz, p, mp, fl, cr) -#define VOP_POLL(vp, events, anyyet, reventsp, phpp) \ - fop_poll(vp, events, anyyet, reventsp, phpp) -#define VOP_DUMP(vp, addr, bn, count) \ - fop_dump(vp, addr, bn, count) -#define VOP_PATHCONF(vp, cmd, valp, cr) \ - fop_pathconf(vp, cmd, valp, cr) -#define VOP_PAGEIO(vp, pp, io_off, io_len, flags, cr) \ - fop_pageio(vp, pp, io_off, io_len, flags, cr) -#define VOP_DUMPCTL(vp, action, blkp) \ - fop_dumpctl(vp, action, blkp) -#define VOP_DISPOSE(vp, pp, flag, dn, cr) \ - fop_dispose(vp, pp, flag, dn, cr) -#define VOP_GETSECATTR(vp, vsap, f, cr) \ - fop_getsecattr(vp, vsap, f, cr) -#define VOP_SETSECATTR(vp, vsap, f, cr) \ - fop_setsecattr(vp, vsap, f, cr) -#define VOP_SHRLOCK(vp, cmd, shr, f, cr) \ - fop_shrlock(vp, cmd, shr, f, cr) -#define VOP_VNEVENT(vp, vnevent, dvp, fnm) \ - fop_vnevent(vp, vnevent, dvp, fnm) +#define VOP_REALVP(vp1, vp2, ct) \ + fop_realvp(vp1, vp2, ct) +#define VOP_GETPAGE(vp, of, sz, pr, pl, ps, sg, a, rw, cr, ct) \ + fop_getpage(vp, of, sz, pr, pl, ps, sg, a, rw, cr, ct) +#define VOP_PUTPAGE(vp, of, sz, fl, cr, ct) \ + fop_putpage(vp, of, sz, fl, cr, ct) +#define VOP_MAP(vp, of, as, a, sz, p, mp, fl, cr, ct) \ + fop_map(vp, of, as, a, sz, p, mp, fl, cr, ct) +#define VOP_ADDMAP(vp, of, as, a, sz, p, mp, fl, cr, ct) \ + fop_addmap(vp, of, as, a, sz, p, mp, fl, cr, ct) +#define VOP_DELMAP(vp, of, as, a, sz, p, mp, fl, cr, ct) \ + fop_delmap(vp, of, as, a, sz, p, mp, fl, cr, ct) +#define VOP_POLL(vp, events, anyyet, reventsp, phpp, ct) \ + fop_poll(vp, events, anyyet, reventsp, phpp, ct) +#define VOP_DUMP(vp, addr, bn, count, ct) \ + fop_dump(vp, addr, bn, count, ct) +#define VOP_PATHCONF(vp, cmd, valp, cr, ct) \ + fop_pathconf(vp, cmd, valp, cr, ct) +#define VOP_PAGEIO(vp, pp, io_off, io_len, flags, cr, ct) \ + fop_pageio(vp, pp, io_off, io_len, flags, cr, ct) +#define VOP_DUMPCTL(vp, action, blkp, ct) \ + fop_dumpctl(vp, action, blkp, ct) +#define VOP_DISPOSE(vp, pp, flag, dn, cr, ct) \ + fop_dispose(vp, pp, flag, dn, cr, ct) +#define VOP_GETSECATTR(vp, vsap, f, cr, ct) \ + fop_getsecattr(vp, vsap, f, cr, ct) +#define VOP_SETSECATTR(vp, vsap, f, cr, ct) \ + fop_setsecattr(vp, vsap, f, cr, ct) +#define VOP_SHRLOCK(vp, cmd, shr, f, cr, ct) \ + fop_shrlock(vp, cmd, shr, f, cr, ct) +#define VOP_VNEVENT(vp, vnevent, dvp, fnm, ct) \ + fop_vnevent(vp, vnevent, dvp, fnm, ct) #define VOPNAME_OPEN "open" #define VOPNAME_CLOSE "close" @@ -834,10 +1116,19 @@ extern int fop_vnevent(vnode_t *, vnevent_t, vnode_t *, char *); /* * Flags for VOP_LOOKUP + * + * Defined in file.h, but also possible, FIGNORECASE + * */ #define LOOKUP_DIR 0x01 /* want parent dir vp */ #define LOOKUP_XATTR 0x02 /* lookup up extended attr dir */ #define CREATE_XATTR_DIR 0x04 /* Create extended attr dir */ +#define LOOKUP_HAVE_SYSATTR_DIR 0x08 /* Already created virtual GFS dir */ + +/* + * Flags for VOP_READDIR + */ +#define V_RDDIR_ENTFLAGS 0x01 /* request dirent flags */ /* * Flags for VOP_RWLOCK/VOP_RWUNLOCK @@ -866,6 +1157,9 @@ void vn_free(vnode_t *); int vn_is_readonly(vnode_t *); int vn_is_opened(vnode_t *, v_mode_t); int vn_is_mapped(vnode_t *, v_mode_t); +int vn_has_other_opens(vnode_t *, v_mode_t); +void vn_open_upgrade(vnode_t *, int); +void vn_open_downgrade(vnode_t *, int); int vn_can_change_zones(vnode_t *vp); @@ -890,7 +1184,7 @@ int vn_open(char *pnamep, enum uio_seg seg, int filemode, int createmode, struct vnode **vpp, enum create crwhy, mode_t umask); int vn_openat(char *pnamep, enum uio_seg seg, int filemode, int createmode, struct vnode **vpp, enum create crwhy, - mode_t umask, struct vnode *startvp); + mode_t umask, struct vnode *startvp, int fd); int vn_create(char *pnamep, enum uio_seg seg, struct vattr *vap, enum vcexcl excl, int mode, struct vnode **vpp, enum create why, int flag, mode_t umask); @@ -927,15 +1221,15 @@ void vn_setpath(vnode_t *rootvp, struct vnode *startvp, struct vnode *vp, const char *path, size_t plen); /* Vnode event notification */ -void vnevent_rename_src(vnode_t *, vnode_t *, char *); -void vnevent_rename_dest(vnode_t *, vnode_t *, char *); -void vnevent_remove(vnode_t *, vnode_t *, char *); -void vnevent_rmdir(vnode_t *, vnode_t *, char *); -void vnevent_create(vnode_t *); -void vnevent_link(vnode_t *); -void vnevent_rename_dest_dir(vnode_t *); -void vnevent_mountedover(vnode_t *); -int vnevent_support(vnode_t *); +void vnevent_rename_src(vnode_t *, vnode_t *, char *, caller_context_t *); +void vnevent_rename_dest(vnode_t *, vnode_t *, char *, caller_context_t *); +void vnevent_remove(vnode_t *, vnode_t *, char *, caller_context_t *); +void vnevent_rmdir(vnode_t *, vnode_t *, char *, caller_context_t *); +void vnevent_create(vnode_t *, caller_context_t *); +void vnevent_link(vnode_t *, caller_context_t *); +void vnevent_rename_dest_dir(vnode_t *, caller_context_t *ct); +void vnevent_mountedover(vnode_t *, caller_context_t *); +int vnevent_support(vnode_t *, caller_context_t *); /* Vnode specific data */ void vsd_create(uint_t *, void (*)(void *)); @@ -944,6 +1238,19 @@ void *vsd_get(vnode_t *, uint_t); int vsd_set(vnode_t *, uint_t, void *); void vsd_free(vnode_t *); +/* + * Extensible vnode attribute (xva) routines: + * xva_init() initializes an xvattr_t (zero struct, init mapsize, set AT_XATTR) + * xva_getxoptattr() returns a ponter to the xoptattr_t section of xvattr_t + */ +void xva_init(xvattr_t *); +xoptattr_t *xva_getxoptattr(xvattr_t *); /* Get ptr to xoptattr_t */ + +void xattr_init(void); /* Initialize vnodeops for xattrs */ + +/* GFS tunnel for xattrs */ +int xattr_dir_lookup(vnode_t *, vnode_t **, int, cred_t *); + /* Context identification */ u_longlong_t fs_new_caller_id(); @@ -976,7 +1283,7 @@ extern uint_t pvn_vmodsort_supported; */ #define VN_CMP(VP1, VP2) ((VP1) == (VP2) ? 1 : \ ((VP1) && (VP2) && (vn_getops(VP1) == vn_getops(VP2)) ? \ - VOP_CMP(VP1, VP2) : 0)) + VOP_CMP(VP1, VP2, NULL) : 0)) extern struct vnode kvp; extern struct vnode zvp; @@ -993,8 +1300,8 @@ extern struct vnode zvp; #define ATTR_COMM 0x04 /* yield common vp attributes */ #define ATTR_HINT 0x08 /* information returned will be `hint' */ #define ATTR_REAL 0x10 /* yield attributes of the real vp */ +#define ATTR_NOACLCHECK 0x20 /* Don't check ACL when checking permissions */ #define ATTR_TRIGGER 0x40 /* Mount first if vnode is a trigger mount */ - /* * Generally useful macros. */ @@ -1026,7 +1333,7 @@ struct async_reqs { #define VN_DISPOSE(pp, flag, dn, cr) { \ extern struct vnode kvp; \ if ((pp)->p_vnode != NULL && !VN_ISKAS((pp)->p_vnode)) \ - VOP_DISPOSE((pp)->p_vnode, (pp), (flag), (dn), (cr)); \ + VOP_DISPOSE((pp)->p_vnode, (pp), (flag), (dn), (cr), NULL); \ else if ((flag) == B_FREE) \ page_free((pp), (dn)); \ else \ |