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 /* 22*99d5e173STim 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" 57*99d5e173STim Haley #define A_GEN "generation" 58da6c28aaSamw 59da6c28aaSamw /* Attribute option for utilities */ 60da6c28aaSamw #define O_HIDDEN "H" 61da6c28aaSamw #define O_SYSTEM "S" 62da6c28aaSamw #define O_READONLY "R" 63da6c28aaSamw #define O_ARCHIVE "A" 64da6c28aaSamw #define O_NOUNLINK "u" 65da6c28aaSamw #define O_IMMUTABLE "i" 66da6c28aaSamw #define O_APPENDONLY "a" 67da6c28aaSamw #define O_NODUMP "d" 68da6c28aaSamw #define O_AV_QUARANTINED "q" 69da6c28aaSamw #define O_AV_MODIFIED "m" 707a286c47SDai Ngo #define O_REPARSE_POINT "r" 71da6c28aaSamw #define O_NONE "" 72da6c28aaSamw 73da6c28aaSamw /* ownersid and groupsid are composed of two nvpairs */ 74da6c28aaSamw #define SID_DOMAIN "domain" 75da6c28aaSamw #define SID_RID "rid" 76da6c28aaSamw 77da6c28aaSamw typedef enum { 78da6c28aaSamw F_ATTR_INVAL = -1, 79da6c28aaSamw F_ARCHIVE, 80da6c28aaSamw F_HIDDEN, 81da6c28aaSamw F_READONLY, 82da6c28aaSamw F_SYSTEM, 83da6c28aaSamw F_APPENDONLY, 84da6c28aaSamw F_NODUMP, 85da6c28aaSamw F_IMMUTABLE, 86da6c28aaSamw F_AV_MODIFIED, 87da6c28aaSamw F_OPAQUE, 88da6c28aaSamw F_AV_SCANSTAMP, 89da6c28aaSamw F_AV_QUARANTINED, 90da6c28aaSamw F_NOUNLINK, 91da6c28aaSamw F_CRTIME, 92da6c28aaSamw F_OWNERSID, 93da6c28aaSamw F_GROUPSID, 94da6c28aaSamw F_FSID, 957a286c47SDai Ngo F_REPARSE, 96*99d5e173STim Haley F_GEN, 97da6c28aaSamw F_ATTR_ALL 98da6c28aaSamw } f_attr_t; 99da6c28aaSamw 100da6c28aaSamw #define VIEW_READONLY "SUNWattr_ro" 101da6c28aaSamw #define VIEW_READWRITE "SUNWattr_rw" 102da6c28aaSamw 103da6c28aaSamw /* 104da6c28aaSamw * These are the supported views into the virtual sysattr directory. 105da6c28aaSamw * Additional views should be added before XATTR_VIEW_LAST. 106da6c28aaSamw */ 107da6c28aaSamw typedef enum { 108da6c28aaSamw XATTR_VIEW_INVALID = -1, 109da6c28aaSamw XATTR_VIEW_READONLY, 110da6c28aaSamw XATTR_VIEW_READWRITE, 111da6c28aaSamw XATTR_VIEW_LAST 112da6c28aaSamw } xattr_view_t; 113da6c28aaSamw 114da6c28aaSamw typedef struct { 115da6c28aaSamw char *x_name; 116da6c28aaSamw char *x_option; 117da6c28aaSamw xattr_view_t x_xattr_view; 118da6c28aaSamw data_type_t x_data_type; 119da6c28aaSamw } xattr_entry_t; 120da6c28aaSamw 121da6c28aaSamw #ifdef _KERNEL 122da6c28aaSamw #define XATTR_MAXFIDSZ NFS_FHMAXDATA 123da6c28aaSamw 124da6c28aaSamw typedef struct { 125da6c28aaSamw uint16_t len; 126da6c28aaSamw char parent_fid[XATTR_MAXFIDSZ]; 127da6c28aaSamw uint16_t parent_len; 128da6c28aaSamw uint16_t dir_offset; 129da6c28aaSamw } xattr_fid_t; 130da6c28aaSamw 131da6c28aaSamw #define XATTR_FIDSZ (sizeof (xattr_fid_t) - sizeof (uint16_t)) 132da6c28aaSamw 133da6c28aaSamw int xattr_dir_vget(vfs_t *, vnode_t **, fid_t *); 134b38f0970Sck153898 int xattr_sysattr_casechk(char *name); 135da6c28aaSamw #endif 136da6c28aaSamw 137da6c28aaSamw int attr_count(void); 138da6c28aaSamw const char *attr_to_name(f_attr_t); 139da6c28aaSamw const char *attr_to_option(f_attr_t); 140da6c28aaSamw f_attr_t name_to_attr(const char *name); 141da6c28aaSamw f_attr_t option_to_attr(const char *option); 142da6c28aaSamw xattr_view_t attr_to_xattr_view(f_attr_t attr); 143da6c28aaSamw data_type_t attr_to_data_type(f_attr_t attr); 144da6c28aaSamw 145da6c28aaSamw #ifdef __cplusplus 146da6c28aaSamw } 147da6c28aaSamw #endif 148da6c28aaSamw 149da6c28aaSamw #endif /* _SYS_ATTR_H */ 150