1 /* 2 * xattrs.h : definitions related to system extended attributes 3 * 4 * Copyright (c) 2010 Jean-Pierre Andre 5 * 6 * This program/include file is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as published 8 * by the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program/include file is distributed in the hope that it will be 12 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty 13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program (in the main directory of the NTFS-3G 18 * distribution in the file COPYING); if not, write to the Free Software 19 * Foundation,Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 */ 21 22 #ifndef _NTFS_XATTRS_H_ 23 #define _NTFS_XATTRS_H_ 24 25 /* 26 * Flags that modify setxattr() semantics. These flags are also used by a 27 * number of libntfs-3g functions, such as ntfs_set_ntfs_acl(), which were 28 * originally tied to extended attributes support but now can be used by 29 * applications even if the platform does not support extended attributes. 30 * 31 * Careful: applications including this header should define HAVE_SETXATTR or 32 * HAVE_SYS_XATTR_H if the platform supports extended attributes. Otherwise the 33 * defined flags values may be incorrect (they will be correct for Linux but not 34 * necessarily for other platforms). 35 */ 36 #if defined(HAVE_SETXATTR) || defined(HAVE_SYS_XATTR_H) 37 #include <sys/xattr.h> 38 #else 39 #include "compat.h" /* may be needed for ENODATA definition */ 40 #define XATTR_CREATE 1 41 #define XATTR_REPLACE 2 42 #endif 43 44 /* 45 * Identification of data mapped to the system name space 46 */ 47 48 enum SYSTEMXATTRS { 49 XATTR_UNMAPPED, 50 XATTR_NTFS_ACL, 51 XATTR_NTFS_ATTRIB, 52 XATTR_NTFS_ATTRIB_BE, 53 XATTR_NTFS_EFSINFO, 54 XATTR_NTFS_REPARSE_DATA, 55 XATTR_NTFS_OBJECT_ID, 56 XATTR_NTFS_DOS_NAME, 57 XATTR_NTFS_TIMES, 58 XATTR_NTFS_TIMES_BE, 59 XATTR_NTFS_CRTIME, 60 XATTR_NTFS_CRTIME_BE, 61 XATTR_NTFS_EA, 62 XATTR_POSIX_ACC, 63 XATTR_POSIX_DEF 64 } ; 65 66 struct XATTRMAPPING { 67 struct XATTRMAPPING *next; 68 enum SYSTEMXATTRS xattr; 69 char name[1]; /* variable length */ 70 } ; 71 72 #ifdef XATTR_MAPPINGS 73 74 struct XATTRMAPPING *ntfs_xattr_build_mapping(ntfs_volume *vol, 75 const char *path); 76 void ntfs_xattr_free_mapping(struct XATTRMAPPING*); 77 78 #endif /* XATTR_MAPPINGS */ 79 80 enum SYSTEMXATTRS ntfs_xattr_system_type(const char *name, 81 ntfs_volume *vol); 82 83 struct SECURITY_CONTEXT; 84 85 int ntfs_xattr_system_getxattr(struct SECURITY_CONTEXT *scx, 86 enum SYSTEMXATTRS attr, 87 ntfs_inode *ni, ntfs_inode *dir_ni, 88 char *value, size_t size); 89 int ntfs_xattr_system_setxattr(struct SECURITY_CONTEXT *scx, 90 enum SYSTEMXATTRS attr, 91 ntfs_inode *ni, ntfs_inode *dir_ni, 92 const char *value, size_t size, int flags); 93 int ntfs_xattr_system_removexattr(struct SECURITY_CONTEXT *scx, 94 enum SYSTEMXATTRS attr, 95 ntfs_inode *ni, ntfs_inode *dir_ni); 96 97 #endif /* _NTFS_XATTRS_H_ */ 98