audio: replace the resampling loop in audio_pcm_sw_write()
[qemu/ar7.git] / hw / 9pfs / 9p-util-linux.c
blobdb451b0784805a3e028ecff6b7bbbaf9d4f3d4ec
1 /*
2 * 9p utilities (Linux Implementation)
4 * Copyright IBM, Corp. 2017
6 * Authors:
7 * Greg Kurz <groug@kaod.org>
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
14 * Not so fast! You might want to read the 9p developer docs first:
15 * https://wiki.qemu.org/Documentation/9p
18 #include "qemu/osdep.h"
19 #include "qemu/xattr.h"
20 #include "9p-util.h"
22 ssize_t fgetxattrat_nofollow(int dirfd, const char *filename, const char *name,
23 void *value, size_t size)
25 char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename);
26 int ret;
28 ret = lgetxattr(proc_path, name, value, size);
29 g_free(proc_path);
30 return ret;
33 ssize_t flistxattrat_nofollow(int dirfd, const char *filename,
34 char *list, size_t size)
36 char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename);
37 int ret;
39 ret = llistxattr(proc_path, list, size);
40 g_free(proc_path);
41 return ret;
44 ssize_t fremovexattrat_nofollow(int dirfd, const char *filename,
45 const char *name)
47 char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename);
48 int ret;
50 ret = lremovexattr(proc_path, name);
51 g_free(proc_path);
52 return ret;
55 int fsetxattrat_nofollow(int dirfd, const char *filename, const char *name,
56 void *value, size_t size, int flags)
58 char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename);
59 int ret;
61 ret = lsetxattr(proc_path, name, value, size, flags);
62 g_free(proc_path);
63 return ret;
67 int qemu_mknodat(int dirfd, const char *filename, mode_t mode, dev_t dev)
69 return mknodat(dirfd, filename, mode, dev);