1219089Spjd/* 2219089Spjd * CDDL HEADER START 3219089Spjd * 4219089Spjd * The contents of this file are subject to the terms of the 5219089Spjd * Common Development and Distribution License (the "License"). 6219089Spjd * You may not use this file except in compliance with the License. 7219089Spjd * 8219089Spjd * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9219089Spjd * or http://www.opensolaris.org/os/licensing. 10219089Spjd * See the License for the specific language governing permissions 11219089Spjd * and limitations under the License. 12219089Spjd * 13219089Spjd * When distributing Covered Code, include this CDDL HEADER in each 14219089Spjd * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15219089Spjd * If applicable, add the following below this CDDL HEADER, with the 16219089Spjd * fields enclosed by brackets "[]" replaced with your own identifying 17219089Spjd * information: Portions Copyright [yyyy] [name of copyright owner] 18219089Spjd * 19219089Spjd * CDDL HEADER END 20219089Spjd */ 21219089Spjd/* 22219089Spjd * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 23219089Spjd * Use is subject to license terms. 24219089Spjd */ 25219089Spjd 26219089Spjd#ifndef _SYS_ZFS_SA_H 27219089Spjd#define _SYS_ZFS_SA_H 28219089Spjd 29219089Spjd#ifdef _KERNEL 30219089Spjd#include <sys/list.h> 31219089Spjd#include <sys/dmu.h> 32219089Spjd#include <sys/zfs_acl.h> 33219089Spjd#include <sys/zfs_znode.h> 34219089Spjd#include <sys/sa.h> 35219089Spjd#include <sys/zil.h> 36219089Spjd 37219089Spjd 38219089Spjd#endif 39219089Spjd 40219089Spjd#ifdef __cplusplus 41219089Spjdextern "C" { 42219089Spjd#endif 43219089Spjd 44219089Spjd/* 45219089Spjd * This is the list of known attributes 46219089Spjd * to the ZPL. The values of the actual 47219089Spjd * attributes are not defined by the order 48219089Spjd * the enums. It is controlled by the attribute 49219089Spjd * registration mechanism. Two different file system 50219089Spjd * could have different numeric values for the same 51219089Spjd * attributes. this list is only used for dereferencing 52219089Spjd * into the table that will hold the actual numeric value. 53219089Spjd */ 54219089Spjdtypedef enum zpl_attr { 55219089Spjd ZPL_ATIME, 56219089Spjd ZPL_MTIME, 57219089Spjd ZPL_CTIME, 58219089Spjd ZPL_CRTIME, 59219089Spjd ZPL_GEN, 60219089Spjd ZPL_MODE, 61219089Spjd ZPL_SIZE, 62219089Spjd ZPL_PARENT, 63219089Spjd ZPL_LINKS, 64219089Spjd ZPL_XATTR, 65219089Spjd ZPL_RDEV, 66219089Spjd ZPL_FLAGS, 67219089Spjd ZPL_UID, 68219089Spjd ZPL_GID, 69219089Spjd ZPL_PAD, 70219089Spjd ZPL_ZNODE_ACL, 71219089Spjd ZPL_DACL_COUNT, 72219089Spjd ZPL_SYMLINK, 73219089Spjd ZPL_SCANSTAMP, 74219089Spjd ZPL_DACL_ACES, 75219089Spjd ZPL_END 76219089Spjd} zpl_attr_t; 77219089Spjd 78219089Spjd#define ZFS_OLD_ZNODE_PHYS_SIZE 0x108 79219089Spjd#define ZFS_SA_BASE_ATTR_SIZE (ZFS_OLD_ZNODE_PHYS_SIZE - \ 80219089Spjd sizeof (zfs_acl_phys_t)) 81219089Spjd 82219089Spjd#define SA_MODE_OFFSET 0 83219089Spjd#define SA_SIZE_OFFSET 8 84219089Spjd#define SA_GEN_OFFSET 16 85219089Spjd#define SA_UID_OFFSET 24 86219089Spjd#define SA_GID_OFFSET 32 87219089Spjd#define SA_PARENT_OFFSET 40 88219089Spjd 89219089Spjdextern sa_attr_reg_t zfs_attr_table[ZPL_END + 1]; 90219089Spjdextern sa_attr_reg_t zfs_legacy_attr_table[ZPL_END + 1]; 91219089Spjd 92219089Spjd/* 93219089Spjd * This is a deprecated data structure that only exists for 94219089Spjd * dealing with file systems create prior to ZPL version 5. 95219089Spjd */ 96219089Spjdtypedef struct znode_phys { 97219089Spjd uint64_t zp_atime[2]; /* 0 - last file access time */ 98219089Spjd uint64_t zp_mtime[2]; /* 16 - last file modification time */ 99219089Spjd uint64_t zp_ctime[2]; /* 32 - last file change time */ 100219089Spjd uint64_t zp_crtime[2]; /* 48 - creation time */ 101219089Spjd uint64_t zp_gen; /* 64 - generation (txg of creation) */ 102219089Spjd uint64_t zp_mode; /* 72 - file mode bits */ 103219089Spjd uint64_t zp_size; /* 80 - size of file */ 104219089Spjd uint64_t zp_parent; /* 88 - directory parent (`..') */ 105219089Spjd uint64_t zp_links; /* 96 - number of links to file */ 106219089Spjd uint64_t zp_xattr; /* 104 - DMU object for xattrs */ 107219089Spjd uint64_t zp_rdev; /* 112 - dev_t for VBLK & VCHR files */ 108219089Spjd uint64_t zp_flags; /* 120 - persistent flags */ 109219089Spjd uint64_t zp_uid; /* 128 - file owner */ 110219089Spjd uint64_t zp_gid; /* 136 - owning group */ 111219089Spjd uint64_t zp_zap; /* 144 - extra attributes */ 112219089Spjd uint64_t zp_pad[3]; /* 152 - future */ 113219089Spjd zfs_acl_phys_t zp_acl; /* 176 - 263 ACL */ 114219089Spjd /* 115219089Spjd * Data may pad out any remaining bytes in the znode buffer, eg: 116219089Spjd * 117219089Spjd * |<---------------------- dnode_phys (512) ------------------------>| 118219089Spjd * |<-- dnode (192) --->|<----------- "bonus" buffer (320) ---------->| 119219089Spjd * |<---- znode (264) ---->|<---- data (56) ---->| 120219089Spjd * 121219089Spjd * At present, we use this space for the following: 122219089Spjd * - symbolic links 123219089Spjd * - 32-byte anti-virus scanstamp (regular files only) 124219089Spjd */ 125219089Spjd} znode_phys_t; 126219089Spjd 127219089Spjd#ifdef _KERNEL 128219089Spjdint zfs_sa_readlink(struct znode *, uio_t *); 129219089Spjdvoid zfs_sa_symlink(struct znode *, char *link, int len, dmu_tx_t *); 130219089Spjdvoid zfs_sa_upgrade(struct sa_handle *, dmu_tx_t *); 131219089Spjdvoid zfs_sa_get_scanstamp(struct znode *, xvattr_t *); 132219089Spjdvoid zfs_sa_set_scanstamp(struct znode *, xvattr_t *, dmu_tx_t *); 133219089Spjdvoid zfs_sa_uprade_pre(struct sa_handle *, void *, dmu_tx_t *); 134219089Spjdvoid zfs_sa_upgrade_post(struct sa_handle *, void *, dmu_tx_t *); 135219089Spjdvoid zfs_sa_upgrade_txholds(dmu_tx_t *, struct znode *); 136219089Spjd#endif 137219089Spjd 138219089Spjd#ifdef __cplusplus 139219089Spjd} 140219089Spjd#endif 141219089Spjd 142219089Spjd#endif /* _SYS_ZFS_SA_H */ 143