attr.h revision 5663:029cc4273b57
1272343Sngie/* 2272343Sngie * CDDL HEADER START 3272343Sngie * 4272343Sngie * The contents of this file are subject to the terms of the 5272343Sngie * Common Development and Distribution License (the "License"). 6272343Sngie * You may not use this file except in compliance with the License. 7272343Sngie * 8272343Sngie * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9272343Sngie * or http://www.opensolaris.org/os/licensing. 10272343Sngie * See the License for the specific language governing permissions 11272343Sngie * and limitations under the License. 12272343Sngie * 13272343Sngie * When distributing Covered Code, include this CDDL HEADER in each 14272343Sngie * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15272343Sngie * If applicable, add the following below this CDDL HEADER, with the 16272343Sngie * fields enclosed by brackets "[]" replaced with your own identifying 17272343Sngie * information: Portions Copyright [yyyy] [name of copyright owner] 18272343Sngie * 19272343Sngie * CDDL HEADER END 20272343Sngie */ 21272343Sngie/* 22272343Sngie * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23272343Sngie * Use is subject to license terms. 24272343Sngie */ 25272343Sngie 26272343Sngie#ifndef _SYS_ATTR_H 27272343Sngie#define _SYS_ATTR_H 28272343Sngie 29272343Sngie#pragma ident "%Z%%M% %I% %E% SMI" 30272343Sngie 31272343Sngie#ifdef __cplusplus 32272343Sngieextern "C" { 33272343Sngie#endif 34272343Sngie 35272343Sngie#ifdef _KERNEL 36272343Sngie#include <sys/vnode.h> 37272343Sngie#include <sys/vfs.h> 38272343Sngie#include <nfs/nfs.h> 39272343Sngie#endif 40272343Sngie#include <sys/nvpair.h> 41272343Sngie 42272343Sngie/* Attribute names for nvlist's */ 43272343Sngie#define A_CRTIME "crtime" 44272343Sngie#define A_HIDDEN "hidden" 45272343Sngie#define A_SYSTEM "system" 46272343Sngie#define A_READONLY "readonly" 47272343Sngie#define A_ARCHIVE "archive" 48272343Sngie#define A_NOUNLINK "nounlink" 49272343Sngie#define A_IMMUTABLE "immutable" 50272343Sngie#define A_APPENDONLY "appendonly" 51272343Sngie#define A_NODUMP "nodump" 52272343Sngie#define A_OPAQUE "opaque" 53272343Sngie#define A_AV_QUARANTINED "av_quarantined" 54272343Sngie#define A_AV_MODIFIED "av_modified" 55272343Sngie#define A_FSID "fsid" 56272343Sngie#define A_AV_SCANSTAMP "av_scanstamp" 57272343Sngie#define A_MDEV "mdev" 58272343Sngie#define A_OWNERSID "ownersid" 59272343Sngie#define A_GROUPSID "groupsid" 60272343Sngie 61272343Sngie/* Attribute option for utilities */ 62272343Sngie#define O_HIDDEN "H" 63272343Sngie#define O_SYSTEM "S" 64272343Sngie#define O_READONLY "R" 65272343Sngie#define O_ARCHIVE "A" 66272343Sngie#define O_NOUNLINK "u" 67272343Sngie#define O_IMMUTABLE "i" 68272343Sngie#define O_APPENDONLY "a" 69272343Sngie#define O_NODUMP "d" 70272343Sngie#define O_AV_QUARANTINED "q" 71272343Sngie#define O_AV_MODIFIED "m" 72272343Sngie#define O_NONE "" 73272343Sngie 74272343Sngie/* ownersid and groupsid are composed of two nvpairs */ 75272343Sngie#define SID_DOMAIN "domain" 76272343Sngie#define SID_RID "rid" 77272343Sngie 78272343Sngietypedef enum { 79272343Sngie F_ATTR_INVAL = -1, 80272343Sngie F_ARCHIVE, 81272343Sngie F_HIDDEN, 82272343Sngie F_READONLY, 83272343Sngie F_SYSTEM, 84272343Sngie F_APPENDONLY, 85272343Sngie F_NODUMP, 86272343Sngie F_IMMUTABLE, 87272343Sngie F_AV_MODIFIED, 88272343Sngie F_OPAQUE, 89272343Sngie F_AV_SCANSTAMP, 90272343Sngie F_AV_QUARANTINED, 91272343Sngie F_NOUNLINK, 92272343Sngie F_CRTIME, 93272343Sngie F_OWNERSID, 94272343Sngie F_GROUPSID, 95272343Sngie F_FSID, 96272343Sngie F_MDEV, 97272343Sngie F_ATTR_ALL 98272343Sngie} f_attr_t; 99272343Sngie 100272343Sngie#define VIEW_READONLY "SUNWattr_ro" 101272343Sngie#define VIEW_READWRITE "SUNWattr_rw" 102272343Sngie 103272343Sngie/* 104272343Sngie * These are the supported views into the virtual sysattr directory. 105272343Sngie * Additional views should be added before XATTR_VIEW_LAST. 106272343Sngie */ 107272343Sngietypedef enum { 108272343Sngie XATTR_VIEW_INVALID = -1, 109272343Sngie XATTR_VIEW_READONLY, 110272343Sngie XATTR_VIEW_READWRITE, 111272343Sngie XATTR_VIEW_LAST 112272343Sngie} xattr_view_t; 113272343Sngie 114272343Sngietypedef struct { 115272343Sngie char *x_name; 116272343Sngie char *x_option; 117272343Sngie xattr_view_t x_xattr_view; 118272343Sngie data_type_t x_data_type; 119272343Sngie} xattr_entry_t; 120272343Sngie 121272343Sngie#ifdef _KERNEL 122272343Sngie#define XATTR_MAXFIDSZ NFS_FHMAXDATA 123272343Sngie 124272343Sngietypedef struct { 125272343Sngie uint16_t len; 126272343Sngie char parent_fid[XATTR_MAXFIDSZ]; 127272343Sngie uint16_t parent_len; 128272343Sngie uint16_t dir_offset; 129272343Sngie} xattr_fid_t; 130272343Sngie 131272343Sngie#define XATTR_FIDSZ (sizeof (xattr_fid_t) - sizeof (uint16_t)) 132272343Sngie 133272343Sngieint xattr_dir_vget(vfs_t *, vnode_t **, fid_t *); 134272343Sngieint xattr_sysattr_casechk(char *name); 135272343Sngie#endif 136272343Sngie 137272343Sngieint attr_count(void); 138272343Sngieconst char *attr_to_name(f_attr_t); 139272343Sngieconst char *attr_to_option(f_attr_t); 140272343Sngief_attr_t name_to_attr(const char *name); 141272343Sngief_attr_t option_to_attr(const char *option); 142272343Sngiexattr_view_t attr_to_xattr_view(f_attr_t attr); 143272343Sngiedata_type_t attr_to_data_type(f_attr_t attr); 144272343Sngie 145272343Sngie#ifdef __cplusplus 146272343Sngie} 147272343Sngie#endif 148272343Sngie 149272343Sngie#endif /* _SYS_ATTR_H */ 150272343Sngie