15331Samw /* 25331Samw * CDDL HEADER START 35331Samw * 45331Samw * The contents of this file are subject to the terms of the 55331Samw * Common Development and Distribution License (the "License"). 65331Samw * You may not use this file except in compliance with the License. 75331Samw * 85331Samw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 95331Samw * or http://www.opensolaris.org/os/licensing. 105331Samw * See the License for the specific language governing permissions 115331Samw * and limitations under the License. 125331Samw * 135331Samw * When distributing Covered Code, include this CDDL HEADER in each 145331Samw * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 155331Samw * If applicable, add the following below this CDDL HEADER, with the 165331Samw * fields enclosed by brackets "[]" replaced with your own identifying 175331Samw * information: Portions Copyright [yyyy] [name of copyright owner] 185331Samw * 195331Samw * CDDL HEADER END 205331Samw */ 215331Samw /* 22*13043STim.Haley@Sun.COM * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. 235331Samw */ 245331Samw 255331Samw #ifndef _SYS_ATTR_H 265331Samw #define _SYS_ATTR_H 275331Samw 285331Samw #ifdef __cplusplus 295331Samw extern "C" { 305331Samw #endif 315331Samw 325331Samw #ifdef _KERNEL 335331Samw #include <sys/vnode.h> 345331Samw #include <sys/vfs.h> 355331Samw #include <nfs/nfs.h> 365331Samw #endif 375331Samw #include <sys/nvpair.h> 385331Samw 395331Samw /* Attribute names for nvlist's */ 405331Samw #define A_CRTIME "crtime" 415331Samw #define A_HIDDEN "hidden" 425331Samw #define A_SYSTEM "system" 435331Samw #define A_READONLY "readonly" 445331Samw #define A_ARCHIVE "archive" 455331Samw #define A_NOUNLINK "nounlink" 465331Samw #define A_IMMUTABLE "immutable" 475331Samw #define A_APPENDONLY "appendonly" 485331Samw #define A_NODUMP "nodump" 495331Samw #define A_OPAQUE "opaque" 505331Samw #define A_AV_QUARANTINED "av_quarantined" 515331Samw #define A_AV_MODIFIED "av_modified" 525331Samw #define A_FSID "fsid" 535331Samw #define A_AV_SCANSTAMP "av_scanstamp" 545331Samw #define A_OWNERSID "ownersid" 555331Samw #define A_GROUPSID "groupsid" 5610793Sdai.ngo@sun.com #define A_REPARSE_POINT "reparse" 57*13043STim.Haley@Sun.COM #define A_GEN "generation" 585331Samw 595331Samw /* Attribute option for utilities */ 605331Samw #define O_HIDDEN "H" 615331Samw #define O_SYSTEM "S" 625331Samw #define O_READONLY "R" 635331Samw #define O_ARCHIVE "A" 645331Samw #define O_NOUNLINK "u" 655331Samw #define O_IMMUTABLE "i" 665331Samw #define O_APPENDONLY "a" 675331Samw #define O_NODUMP "d" 685331Samw #define O_AV_QUARANTINED "q" 695331Samw #define O_AV_MODIFIED "m" 7010793Sdai.ngo@sun.com #define O_REPARSE_POINT "r" 715331Samw #define O_NONE "" 725331Samw 735331Samw /* ownersid and groupsid are composed of two nvpairs */ 745331Samw #define SID_DOMAIN "domain" 755331Samw #define SID_RID "rid" 765331Samw 775331Samw typedef enum { 785331Samw F_ATTR_INVAL = -1, 795331Samw F_ARCHIVE, 805331Samw F_HIDDEN, 815331Samw F_READONLY, 825331Samw F_SYSTEM, 835331Samw F_APPENDONLY, 845331Samw F_NODUMP, 855331Samw F_IMMUTABLE, 865331Samw F_AV_MODIFIED, 875331Samw F_OPAQUE, 885331Samw F_AV_SCANSTAMP, 895331Samw F_AV_QUARANTINED, 905331Samw F_NOUNLINK, 915331Samw F_CRTIME, 925331Samw F_OWNERSID, 935331Samw F_GROUPSID, 945331Samw F_FSID, 9510793Sdai.ngo@sun.com F_REPARSE, 96*13043STim.Haley@Sun.COM F_GEN, 975331Samw F_ATTR_ALL 985331Samw } f_attr_t; 995331Samw 1005331Samw #define VIEW_READONLY "SUNWattr_ro" 1015331Samw #define VIEW_READWRITE "SUNWattr_rw" 1025331Samw 1035331Samw /* 1045331Samw * These are the supported views into the virtual sysattr directory. 1055331Samw * Additional views should be added before XATTR_VIEW_LAST. 1065331Samw */ 1075331Samw typedef enum { 1085331Samw XATTR_VIEW_INVALID = -1, 1095331Samw XATTR_VIEW_READONLY, 1105331Samw XATTR_VIEW_READWRITE, 1115331Samw XATTR_VIEW_LAST 1125331Samw } xattr_view_t; 1135331Samw 1145331Samw typedef struct { 1155331Samw char *x_name; 1165331Samw char *x_option; 1175331Samw xattr_view_t x_xattr_view; 1185331Samw data_type_t x_data_type; 1195331Samw } xattr_entry_t; 1205331Samw 1215331Samw #ifdef _KERNEL 1225331Samw #define XATTR_MAXFIDSZ NFS_FHMAXDATA 1235331Samw 1245331Samw typedef struct { 1255331Samw uint16_t len; 1265331Samw char parent_fid[XATTR_MAXFIDSZ]; 1275331Samw uint16_t parent_len; 1285331Samw uint16_t dir_offset; 1295331Samw } xattr_fid_t; 1305331Samw 1315331Samw #define XATTR_FIDSZ (sizeof (xattr_fid_t) - sizeof (uint16_t)) 1325331Samw 1335331Samw int xattr_dir_vget(vfs_t *, vnode_t **, fid_t *); 1345663Sck153898 int xattr_sysattr_casechk(char *name); 1355331Samw #endif 1365331Samw 1375331Samw int attr_count(void); 1385331Samw const char *attr_to_name(f_attr_t); 1395331Samw const char *attr_to_option(f_attr_t); 1405331Samw f_attr_t name_to_attr(const char *name); 1415331Samw f_attr_t option_to_attr(const char *option); 1425331Samw xattr_view_t attr_to_xattr_view(f_attr_t attr); 1435331Samw data_type_t attr_to_data_type(f_attr_t attr); 1445331Samw 1455331Samw #ifdef __cplusplus 1465331Samw } 1475331Samw #endif 1485331Samw 1495331Samw #endif /* _SYS_ATTR_H */ 150