1*11935SMark.Shellenbaum@Sun.COM /* 2*11935SMark.Shellenbaum@Sun.COM * CDDL HEADER START 3*11935SMark.Shellenbaum@Sun.COM * 4*11935SMark.Shellenbaum@Sun.COM * The contents of this file are subject to the terms of the 5*11935SMark.Shellenbaum@Sun.COM * Common Development and Distribution License (the "License"). 6*11935SMark.Shellenbaum@Sun.COM * You may not use this file except in compliance with the License. 7*11935SMark.Shellenbaum@Sun.COM * 8*11935SMark.Shellenbaum@Sun.COM * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*11935SMark.Shellenbaum@Sun.COM * or http://www.opensolaris.org/os/licensing. 10*11935SMark.Shellenbaum@Sun.COM * See the License for the specific language governing permissions 11*11935SMark.Shellenbaum@Sun.COM * and limitations under the License. 12*11935SMark.Shellenbaum@Sun.COM * 13*11935SMark.Shellenbaum@Sun.COM * When distributing Covered Code, include this CDDL HEADER in each 14*11935SMark.Shellenbaum@Sun.COM * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*11935SMark.Shellenbaum@Sun.COM * If applicable, add the following below this CDDL HEADER, with the 16*11935SMark.Shellenbaum@Sun.COM * fields enclosed by brackets "[]" replaced with your own identifying 17*11935SMark.Shellenbaum@Sun.COM * information: Portions Copyright [yyyy] [name of copyright owner] 18*11935SMark.Shellenbaum@Sun.COM * 19*11935SMark.Shellenbaum@Sun.COM * CDDL HEADER END 20*11935SMark.Shellenbaum@Sun.COM */ 21*11935SMark.Shellenbaum@Sun.COM /* 22*11935SMark.Shellenbaum@Sun.COM * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 23*11935SMark.Shellenbaum@Sun.COM * Use is subject to license terms. 24*11935SMark.Shellenbaum@Sun.COM */ 25*11935SMark.Shellenbaum@Sun.COM 26*11935SMark.Shellenbaum@Sun.COM #ifndef _SYS_ZFS_SA_H 27*11935SMark.Shellenbaum@Sun.COM #define _SYS_ZFS_SA_H 28*11935SMark.Shellenbaum@Sun.COM 29*11935SMark.Shellenbaum@Sun.COM #ifdef _KERNEL 30*11935SMark.Shellenbaum@Sun.COM #include <sys/types32.h> 31*11935SMark.Shellenbaum@Sun.COM #include <sys/list.h> 32*11935SMark.Shellenbaum@Sun.COM #include <sys/dmu.h> 33*11935SMark.Shellenbaum@Sun.COM #include <sys/zfs_acl.h> 34*11935SMark.Shellenbaum@Sun.COM #include <sys/zfs_znode.h> 35*11935SMark.Shellenbaum@Sun.COM #include <sys/sa.h> 36*11935SMark.Shellenbaum@Sun.COM #include <sys/zil.h> 37*11935SMark.Shellenbaum@Sun.COM 38*11935SMark.Shellenbaum@Sun.COM 39*11935SMark.Shellenbaum@Sun.COM #endif 40*11935SMark.Shellenbaum@Sun.COM 41*11935SMark.Shellenbaum@Sun.COM #ifdef __cplusplus 42*11935SMark.Shellenbaum@Sun.COM extern "C" { 43*11935SMark.Shellenbaum@Sun.COM #endif 44*11935SMark.Shellenbaum@Sun.COM 45*11935SMark.Shellenbaum@Sun.COM /* 46*11935SMark.Shellenbaum@Sun.COM * This is the list of known attributes 47*11935SMark.Shellenbaum@Sun.COM * to the ZPL. The values of the actual 48*11935SMark.Shellenbaum@Sun.COM * attributes are not defined by the order 49*11935SMark.Shellenbaum@Sun.COM * the enums. It is controlled by the attribute 50*11935SMark.Shellenbaum@Sun.COM * registration mechanism. Two different file system 51*11935SMark.Shellenbaum@Sun.COM * could have different numeric values for the same 52*11935SMark.Shellenbaum@Sun.COM * attributes. this list is only used for dereferencing 53*11935SMark.Shellenbaum@Sun.COM * into the table that will hold the actual numeric value. 54*11935SMark.Shellenbaum@Sun.COM */ 55*11935SMark.Shellenbaum@Sun.COM typedef enum zpl_attr { 56*11935SMark.Shellenbaum@Sun.COM ZPL_ATIME, 57*11935SMark.Shellenbaum@Sun.COM ZPL_MTIME, 58*11935SMark.Shellenbaum@Sun.COM ZPL_CTIME, 59*11935SMark.Shellenbaum@Sun.COM ZPL_CRTIME, 60*11935SMark.Shellenbaum@Sun.COM ZPL_GEN, 61*11935SMark.Shellenbaum@Sun.COM ZPL_MODE, 62*11935SMark.Shellenbaum@Sun.COM ZPL_SIZE, 63*11935SMark.Shellenbaum@Sun.COM ZPL_PARENT, 64*11935SMark.Shellenbaum@Sun.COM ZPL_LINKS, 65*11935SMark.Shellenbaum@Sun.COM ZPL_XATTR, 66*11935SMark.Shellenbaum@Sun.COM ZPL_RDEV, 67*11935SMark.Shellenbaum@Sun.COM ZPL_FLAGS, 68*11935SMark.Shellenbaum@Sun.COM ZPL_UID, 69*11935SMark.Shellenbaum@Sun.COM ZPL_GID, 70*11935SMark.Shellenbaum@Sun.COM ZPL_PAD, 71*11935SMark.Shellenbaum@Sun.COM ZPL_ZNODE_ACL, 72*11935SMark.Shellenbaum@Sun.COM ZPL_DACL_COUNT, 73*11935SMark.Shellenbaum@Sun.COM ZPL_SYMLINK, 74*11935SMark.Shellenbaum@Sun.COM ZPL_SCANSTAMP, 75*11935SMark.Shellenbaum@Sun.COM ZPL_DACL_ACES, 76*11935SMark.Shellenbaum@Sun.COM ZPL_END 77*11935SMark.Shellenbaum@Sun.COM } zpl_attr_t; 78*11935SMark.Shellenbaum@Sun.COM 79*11935SMark.Shellenbaum@Sun.COM #define ZFS_OLD_ZNODE_PHYS_SIZE 0x108 80*11935SMark.Shellenbaum@Sun.COM #define ZFS_SA_BASE_ATTR_SIZE (ZFS_OLD_ZNODE_PHYS_SIZE - \ 81*11935SMark.Shellenbaum@Sun.COM sizeof (zfs_acl_phys_t)) 82*11935SMark.Shellenbaum@Sun.COM 83*11935SMark.Shellenbaum@Sun.COM #define SA_MODE_OFFSET 0 84*11935SMark.Shellenbaum@Sun.COM #define SA_SIZE_OFFSET 8 85*11935SMark.Shellenbaum@Sun.COM #define SA_GEN_OFFSET 16 86*11935SMark.Shellenbaum@Sun.COM #define SA_UID_OFFSET 24 87*11935SMark.Shellenbaum@Sun.COM #define SA_GID_OFFSET 32 88*11935SMark.Shellenbaum@Sun.COM #define SA_PARENT_OFFSET 40 89*11935SMark.Shellenbaum@Sun.COM 90*11935SMark.Shellenbaum@Sun.COM extern sa_attr_reg_t zfs_attr_table[ZPL_END + 1]; 91*11935SMark.Shellenbaum@Sun.COM extern sa_attr_reg_t zfs_legacy_attr_table[ZPL_END + 1]; 92*11935SMark.Shellenbaum@Sun.COM 93*11935SMark.Shellenbaum@Sun.COM /* 94*11935SMark.Shellenbaum@Sun.COM * This is a deprecated data structure that only exists for 95*11935SMark.Shellenbaum@Sun.COM * dealing with file systems create prior to ZPL version 5. 96*11935SMark.Shellenbaum@Sun.COM */ 97*11935SMark.Shellenbaum@Sun.COM typedef struct znode_phys { 98*11935SMark.Shellenbaum@Sun.COM uint64_t zp_atime[2]; /* 0 - last file access time */ 99*11935SMark.Shellenbaum@Sun.COM uint64_t zp_mtime[2]; /* 16 - last file modification time */ 100*11935SMark.Shellenbaum@Sun.COM uint64_t zp_ctime[2]; /* 32 - last file change time */ 101*11935SMark.Shellenbaum@Sun.COM uint64_t zp_crtime[2]; /* 48 - creation time */ 102*11935SMark.Shellenbaum@Sun.COM uint64_t zp_gen; /* 64 - generation (txg of creation) */ 103*11935SMark.Shellenbaum@Sun.COM uint64_t zp_mode; /* 72 - file mode bits */ 104*11935SMark.Shellenbaum@Sun.COM uint64_t zp_size; /* 80 - size of file */ 105*11935SMark.Shellenbaum@Sun.COM uint64_t zp_parent; /* 88 - directory parent (`..') */ 106*11935SMark.Shellenbaum@Sun.COM uint64_t zp_links; /* 96 - number of links to file */ 107*11935SMark.Shellenbaum@Sun.COM uint64_t zp_xattr; /* 104 - DMU object for xattrs */ 108*11935SMark.Shellenbaum@Sun.COM uint64_t zp_rdev; /* 112 - dev_t for VBLK & VCHR files */ 109*11935SMark.Shellenbaum@Sun.COM uint64_t zp_flags; /* 120 - persistent flags */ 110*11935SMark.Shellenbaum@Sun.COM uint64_t zp_uid; /* 128 - file owner */ 111*11935SMark.Shellenbaum@Sun.COM uint64_t zp_gid; /* 136 - owning group */ 112*11935SMark.Shellenbaum@Sun.COM uint64_t zp_zap; /* 144 - extra attributes */ 113*11935SMark.Shellenbaum@Sun.COM uint64_t zp_pad[3]; /* 152 - future */ 114*11935SMark.Shellenbaum@Sun.COM zfs_acl_phys_t zp_acl; /* 176 - 263 ACL */ 115*11935SMark.Shellenbaum@Sun.COM /* 116*11935SMark.Shellenbaum@Sun.COM * Data may pad out any remaining bytes in the znode buffer, eg: 117*11935SMark.Shellenbaum@Sun.COM * 118*11935SMark.Shellenbaum@Sun.COM * |<---------------------- dnode_phys (512) ------------------------>| 119*11935SMark.Shellenbaum@Sun.COM * |<-- dnode (192) --->|<----------- "bonus" buffer (320) ---------->| 120*11935SMark.Shellenbaum@Sun.COM * |<---- znode (264) ---->|<---- data (56) ---->| 121*11935SMark.Shellenbaum@Sun.COM * 122*11935SMark.Shellenbaum@Sun.COM * At present, we use this space for the following: 123*11935SMark.Shellenbaum@Sun.COM * - symbolic links 124*11935SMark.Shellenbaum@Sun.COM * - 32-byte anti-virus scanstamp (regular files only) 125*11935SMark.Shellenbaum@Sun.COM */ 126*11935SMark.Shellenbaum@Sun.COM } znode_phys_t; 127*11935SMark.Shellenbaum@Sun.COM 128*11935SMark.Shellenbaum@Sun.COM #ifdef _KERNEL 129*11935SMark.Shellenbaum@Sun.COM int zfs_sa_readlink(struct znode *, uio_t *); 130*11935SMark.Shellenbaum@Sun.COM void zfs_sa_symlink(struct znode *, char *link, int len, dmu_tx_t *); 131*11935SMark.Shellenbaum@Sun.COM void zfs_sa_upgrade(struct sa_handle *, dmu_tx_t *); 132*11935SMark.Shellenbaum@Sun.COM void zfs_sa_get_scanstamp(struct znode *, xvattr_t *); 133*11935SMark.Shellenbaum@Sun.COM void zfs_sa_set_scanstamp(struct znode *, xvattr_t *, dmu_tx_t *); 134*11935SMark.Shellenbaum@Sun.COM void zfs_sa_uprade_pre(struct sa_handle *, void *, dmu_tx_t *); 135*11935SMark.Shellenbaum@Sun.COM void zfs_sa_upgrade_post(struct sa_handle *, void *, dmu_tx_t *); 136*11935SMark.Shellenbaum@Sun.COM void zfs_sa_upgrade_txholds(dmu_tx_t *, struct znode *); 137*11935SMark.Shellenbaum@Sun.COM #endif 138*11935SMark.Shellenbaum@Sun.COM 139*11935SMark.Shellenbaum@Sun.COM #ifdef __cplusplus 140*11935SMark.Shellenbaum@Sun.COM } 141*11935SMark.Shellenbaum@Sun.COM #endif 142*11935SMark.Shellenbaum@Sun.COM 143*11935SMark.Shellenbaum@Sun.COM #endif /* _SYS_ZFS_SA_H */ 144