]> git.saurik.com Git - apple/xnu.git/blame - bsd/sys/xattr.h
xnu-792.tar.gz
[apple/xnu.git] / bsd / sys / xattr.h
CommitLineData
91447636
A
1/*
2 * Copyright (c) 2004-2005 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23#ifndef _SYS_XATTR_H_
24#define _SYS_XATTR_H_
25
26#include <sys/types.h>
27
28/* Options for pathname based xattr calls */
29#define XATTR_NOFOLLOW 0x0001 /* Don't follow symbolic links */
30
31/* Options for setxattr calls */
32#define XATTR_CREATE 0x0002 /* set the value, fail if attr already exists */
33#define XATTR_REPLACE 0x0004 /* set the value, fail if attr does not exist */
34
35/* Set this to bypass authorization checking (eg. if doing auth-related work) */
36#define XATTR_NOSECURITY 0x0008
37
38#define XATTR_MAXNAMELEN 127
39
40#define XATTR_FINDERINFO_NAME "com.apple.FinderInfo"
41
42#define XATTR_RESOURCEFORK_NAME "com.apple.ResourceFork"
43
44
45#ifdef KERNEL
46__BEGIN_DECLS
47int xattr_protected(const char *);
48int xattr_validatename(const char *);
49__END_DECLS
50#endif /* KERNEL */
51
52#ifndef KERNEL
53__BEGIN_DECLS
54
55ssize_t getxattr(const char *path, const char *name, void *value, size_t size, u_int32_t position, int options);
56
57ssize_t fgetxattr(int fd, const char *name, void *value, size_t size, u_int32_t position, int options);
58
59int setxattr(const char *path, const char *name, const void *value, size_t size, u_int32_t position, int options);
60
61int fsetxattr(int fd, const char *name, const void *value, size_t size, u_int32_t position, int options);
62
63int removexattr(const char *path, const char *name, int options);
64
65int fremovexattr(int fd, const char *name, int options);
66
67ssize_t listxattr(const char *path, char *namebuff, size_t size, int options);
68
69ssize_t flistxattr(int fd, char *namebuff, size_t size, int options);
70
71__END_DECLS
72#endif /* KERNEL */
73
74#endif /* _SYS_XATTR_H_ */