1da6c28aaSamw /* 2da6c28aaSamw * CDDL HEADER START 3da6c28aaSamw * 4da6c28aaSamw * The contents of this file are subject to the terms of the 5da6c28aaSamw * Common Development and Distribution License (the "License"). 6da6c28aaSamw * You may not use this file except in compliance with the License. 7da6c28aaSamw * 8da6c28aaSamw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9da6c28aaSamw * or http://www.opensolaris.org/os/licensing. 10da6c28aaSamw * See the License for the specific language governing permissions 11da6c28aaSamw * and limitations under the License. 12da6c28aaSamw * 13da6c28aaSamw * When distributing Covered Code, include this CDDL HEADER in each 14da6c28aaSamw * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15da6c28aaSamw * If applicable, add the following below this CDDL HEADER, with the 16da6c28aaSamw * fields enclosed by brackets "[]" replaced with your own identifying 17da6c28aaSamw * information: Portions Copyright [yyyy] [name of copyright owner] 18da6c28aaSamw * 19da6c28aaSamw * CDDL HEADER END 20da6c28aaSamw */ 21da6c28aaSamw /* 2299d5e173STim Haley * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 23da6c28aaSamw */ 24da6c28aaSamw 25da6c28aaSamw #ifndef _SYS_ATTR_H 26da6c28aaSamw #define _SYS_ATTR_H 27da6c28aaSamw 28da6c28aaSamw #ifdef __cplusplus 29da6c28aaSamw extern "C" { 30da6c28aaSamw #endif 31da6c28aaSamw 32da6c28aaSamw #ifdef _KERNEL 33da6c28aaSamw #include <sys/vnode.h> 34da6c28aaSamw #include <sys/vfs.h> 35da6c28aaSamw #include <nfs/nfs.h> 36da6c28aaSamw #endif 37da6c28aaSamw #include <sys/nvpair.h> 38da6c28aaSamw 39da6c28aaSamw /* Attribute names for nvlist's */ 40da6c28aaSamw #define A_CRTIME "crtime" 41da6c28aaSamw #define A_HIDDEN "hidden" 42da6c28aaSamw #define A_SYSTEM "system" 43da6c28aaSamw #define A_READONLY "readonly" 44da6c28aaSamw #define A_ARCHIVE "archive" 45da6c28aaSamw #define A_NOUNLINK "nounlink" 46da6c28aaSamw #define A_IMMUTABLE "immutable" 47da6c28aaSamw #define A_APPENDONLY "appendonly" 48da6c28aaSamw #define A_NODUMP "nodump" 49da6c28aaSamw #define A_OPAQUE "opaque" 50da6c28aaSamw #define A_AV_QUARANTINED "av_quarantined" 51da6c28aaSamw #define A_AV_MODIFIED "av_modified" 52da6c28aaSamw #define A_FSID "fsid" 53da6c28aaSamw #define A_AV_SCANSTAMP "av_scanstamp" 54da6c28aaSamw #define A_OWNERSID "ownersid" 55da6c28aaSamw #define A_GROUPSID "groupsid" 567a286c47SDai Ngo #define A_REPARSE_POINT "reparse" 5799d5e173STim Haley #define A_GEN "generation" 58*fd9ee8b5Sjoyce mcintosh #define A_OFFLINE "offline" 59*fd9ee8b5Sjoyce mcintosh #define A_SPARSE "sparse" 60da6c28aaSamw 61da6c28aaSamw /* Attribute option for utilities */ 62da6c28aaSamw #define O_HIDDEN "H" 63da6c28aaSamw #define O_SYSTEM "S" 64da6c28aaSamw #define O_READONLY "R" 65da6c28aaSamw #define O_ARCHIVE "A" 66da6c28aaSamw #define O_NOUNLINK "u" 67da6c28aaSamw #define O_IMMUTABLE "i" 68da6c28aaSamw #define O_APPENDONLY "a" 69da6c28aaSamw #define O_NODUMP "d" 70da6c28aaSamw #define O_AV_QUARANTINED "q" 71da6c28aaSamw #define O_AV_MODIFIED "m" 727a286c47SDai Ngo #define O_REPARSE_POINT "r" 73*fd9ee8b5Sjoyce mcintosh #define O_OFFLINE "O" 74*fd9ee8b5Sjoyce mcintosh #define O_SPARSE "s" 75da6c28aaSamw #define O_NONE "" 76da6c28aaSamw 77da6c28aaSamw /* ownersid and groupsid are composed of two nvpairs */ 78da6c28aaSamw #define SID_DOMAIN "domain" 79da6c28aaSamw #define SID_RID "rid" 80da6c28aaSamw 81da6c28aaSamw typedef enum { 82da6c28aaSamw F_ATTR_INVAL = -1, 83da6c28aaSamw F_ARCHIVE, 84da6c28aaSamw F_HIDDEN, 85da6c28aaSamw F_READONLY, 86da6c28aaSamw F_SYSTEM, 87da6c28aaSamw F_APPENDONLY, 88da6c28aaSamw F_NODUMP, 89da6c28aaSamw F_IMMUTABLE, 90da6c28aaSamw F_AV_MODIFIED, 91da6c28aaSamw F_OPAQUE, 92da6c28aaSamw F_AV_SCANSTAMP, 93da6c28aaSamw F_AV_QUARANTINED, 94da6c28aaSamw F_NOUNLINK, 95da6c28aaSamw F_CRTIME, 96da6c28aaSamw F_OWNERSID, 97da6c28aaSamw F_GROUPSID, 98da6c28aaSamw F_FSID, 997a286c47SDai Ngo F_REPARSE, 10099d5e173STim Haley F_GEN, 101*fd9ee8b5Sjoyce mcintosh F_OFFLINE, 102*fd9ee8b5Sjoyce mcintosh F_SPARSE, 103da6c28aaSamw F_ATTR_ALL 104da6c28aaSamw } f_attr_t; 105da6c28aaSamw 106da6c28aaSamw #define VIEW_READONLY "SUNWattr_ro" 107da6c28aaSamw #define VIEW_READWRITE "SUNWattr_rw" 108da6c28aaSamw 109da6c28aaSamw /* 110da6c28aaSamw * These are the supported views into the virtual sysattr directory. 111da6c28aaSamw * Additional views should be added before XATTR_VIEW_LAST. 112da6c28aaSamw */ 113da6c28aaSamw typedef enum { 114da6c28aaSamw XATTR_VIEW_INVALID = -1, 115da6c28aaSamw XATTR_VIEW_READONLY, 116da6c28aaSamw XATTR_VIEW_READWRITE, 117da6c28aaSamw XATTR_VIEW_LAST 118da6c28aaSamw } xattr_view_t; 119da6c28aaSamw 120da6c28aaSamw typedef struct { 121da6c28aaSamw char *x_name; 122da6c28aaSamw char *x_option; 123da6c28aaSamw xattr_view_t x_xattr_view; 124da6c28aaSamw data_type_t x_data_type; 125da6c28aaSamw } xattr_entry_t; 126da6c28aaSamw 127da6c28aaSamw #ifdef _KERNEL 128da6c28aaSamw #define XATTR_MAXFIDSZ NFS_FHMAXDATA 129da6c28aaSamw 130da6c28aaSamw typedef struct { 131da6c28aaSamw uint16_t len; 132da6c28aaSamw char parent_fid[XATTR_MAXFIDSZ]; 133da6c28aaSamw uint16_t parent_len; 134da6c28aaSamw uint16_t dir_offset; 135da6c28aaSamw } xattr_fid_t; 136da6c28aaSamw 137da6c28aaSamw #define XATTR_FIDSZ (sizeof (xattr_fid_t) - sizeof (uint16_t)) 138da6c28aaSamw 139da6c28aaSamw int xattr_dir_vget(vfs_t *, vnode_t **, fid_t *); 140b38f0970Sck153898 int xattr_sysattr_casechk(char *name); 141da6c28aaSamw #endif 142da6c28aaSamw 143da6c28aaSamw int attr_count(void); 144da6c28aaSamw const char *attr_to_name(f_attr_t); 145da6c28aaSamw const char *attr_to_option(f_attr_t); 146da6c28aaSamw f_attr_t name_to_attr(const char *name); 147da6c28aaSamw f_attr_t option_to_attr(const char *option); 148da6c28aaSamw xattr_view_t attr_to_xattr_view(f_attr_t attr); 149da6c28aaSamw data_type_t attr_to_data_type(f_attr_t attr); 150da6c28aaSamw 151da6c28aaSamw #ifdef __cplusplus 152da6c28aaSamw } 153da6c28aaSamw #endif 154da6c28aaSamw 155da6c28aaSamw #endif /* _SYS_ATTR_H */ 156