tcp: Fix 64 bit build with debugging features enabled.
[haiku.git] / src / build / libroot / fs_attr_xattr.h
blobac40aefc8752be7416b878efd3963416f2d4af16
1 /*
2 * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef FS_ATTR_XATTR_H
6 #define FS_ATTR_XATTR_H
8 /*! Included by fs_attr_untyped.cpp. Interfaces with Linux xattr support.
9 */
12 #include <sys/xattr.h>
15 // the namespace all attributes live in
16 static const char* kAttributeNamespace = "user.haiku.";
17 static const int kAttributeNamespaceLen = 11;
20 static ssize_t
21 list_attributes(int fd, const char* path, char* buffer, size_t bufferSize)
23 if (fd >= 0)
24 return flistxattr(fd, buffer, bufferSize);
25 return llistxattr(path, buffer, bufferSize);
29 static ssize_t
30 get_attribute(int fd, const char* path, const char* attribute, void* buffer,
31 size_t bufferSize)
33 if (fd >= 0)
34 return fgetxattr(fd, attribute, buffer, bufferSize);
35 return lgetxattr(path, attribute, buffer, bufferSize);
39 static int
40 set_attribute(int fd, const char* path, const char* attribute,
41 const void* buffer, size_t bufferSize)
43 if (fd >= 0)
44 return fsetxattr(fd, attribute, buffer, bufferSize, 0);
45 return lsetxattr(path, attribute, buffer, bufferSize, 0);
49 static int
50 remove_attribute(int fd, const char* path, const char* attribute)
52 if (fd >= 0)
53 return fremovexattr(fd, attribute);
54 return lremovexattr(path, attribute);
58 #endif // FS_ATTR_XATTR_H