1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#include "qemu/osdep.h"
19#include "qemu/xattr.h"
20#include "9p-util.h"
21
22ssize_t fgetxattrat_nofollow(int dirfd, const char *filename, const char *name,
23 void *value, size_t size)
24{
25 char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename);
26 int ret;
27
28 ret = lgetxattr(proc_path, name, value, size);
29 g_free(proc_path);
30 return ret;
31}
32
33ssize_t flistxattrat_nofollow(int dirfd, const char *filename,
34 char *list, size_t size)
35{
36 char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename);
37 int ret;
38
39 ret = llistxattr(proc_path, list, size);
40 g_free(proc_path);
41 return ret;
42}
43
44ssize_t fremovexattrat_nofollow(int dirfd, const char *filename,
45 const char *name)
46{
47 char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename);
48 int ret;
49
50 ret = lremovexattr(proc_path, name);
51 g_free(proc_path);
52 return ret;
53}
54
55int fsetxattrat_nofollow(int dirfd, const char *filename, const char *name,
56 void *value, size_t size, int flags)
57{
58 char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename);
59 int ret;
60
61 ret = lsetxattr(proc_path, name, value, size, flags);
62 g_free(proc_path);
63 return ret;
64}
65