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 /* 225331Samw * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 235331Samw * Use is subject to license terms. 245331Samw */ 255331Samw 265331Samw #ifndef _SYS_ATTR_H 275331Samw #define _SYS_ATTR_H 285331Samw 295331Samw #pragma ident "%Z%%M% %I% %E% SMI" 305331Samw 315331Samw #ifdef __cplusplus 325331Samw extern "C" { 335331Samw #endif 345331Samw 355331Samw #ifdef _KERNEL 365331Samw #include <sys/vnode.h> 375331Samw #include <sys/vfs.h> 385331Samw #include <nfs/nfs.h> 395331Samw #endif 405331Samw #include <sys/nvpair.h> 415331Samw 425331Samw /* Attribute names for nvlist's */ 435331Samw #define A_CRTIME "crtime" 445331Samw #define A_HIDDEN "hidden" 455331Samw #define A_SYSTEM "system" 465331Samw #define A_READONLY "readonly" 475331Samw #define A_ARCHIVE "archive" 485331Samw #define A_NOUNLINK "nounlink" 495331Samw #define A_IMMUTABLE "immutable" 505331Samw #define A_APPENDONLY "appendonly" 515331Samw #define A_NODUMP "nodump" 525331Samw #define A_OPAQUE "opaque" 535331Samw #define A_AV_QUARANTINED "av_quarantined" 545331Samw #define A_AV_MODIFIED "av_modified" 555331Samw #define A_FSID "fsid" 565331Samw #define A_AV_SCANSTAMP "av_scanstamp" 575331Samw #define A_MDEV "mdev" 585331Samw #define A_OWNERSID "ownersid" 595331Samw #define A_GROUPSID "groupsid" 605331Samw 615331Samw /* Attribute option for utilities */ 625331Samw #define O_HIDDEN "H" 635331Samw #define O_SYSTEM "S" 645331Samw #define O_READONLY "R" 655331Samw #define O_ARCHIVE "A" 665331Samw #define O_NOUNLINK "u" 675331Samw #define O_IMMUTABLE "i" 685331Samw #define O_APPENDONLY "a" 695331Samw #define O_NODUMP "d" 705331Samw #define O_AV_QUARANTINED "q" 715331Samw #define O_AV_MODIFIED "m" 725331Samw #define O_NONE "" 735331Samw 745331Samw /* ownersid and groupsid are composed of two nvpairs */ 755331Samw #define SID_DOMAIN "domain" 765331Samw #define SID_RID "rid" 775331Samw 785331Samw typedef enum { 795331Samw F_ATTR_INVAL = -1, 805331Samw F_ARCHIVE, 815331Samw F_HIDDEN, 825331Samw F_READONLY, 835331Samw F_SYSTEM, 845331Samw F_APPENDONLY, 855331Samw F_NODUMP, 865331Samw F_IMMUTABLE, 875331Samw F_AV_MODIFIED, 885331Samw F_OPAQUE, 895331Samw F_AV_SCANSTAMP, 905331Samw F_AV_QUARANTINED, 915331Samw F_NOUNLINK, 925331Samw F_CRTIME, 935331Samw F_OWNERSID, 945331Samw F_GROUPSID, 955331Samw F_FSID, 965331Samw F_MDEV, 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 *); 134*5663Sck153898 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