mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
[virtio-9p] Make rpath thread safe
Current rpath inline function is heavily used in all system calls. This function has a static buffer making it a non-thread safe function. This patch introduces new thread-safe routine and makes use of it. Signed-off-by: Venkateswararao Jujjuri "<jvrao@linux.vnet.ibm.com>
This commit is contained in:
parent
873c321393
commit
faa44e3d3e
7 changed files with 98 additions and 92 deletions
|
@ -26,7 +26,8 @@
|
|||
static ssize_t mp_pacl_getxattr(FsContext *ctx, const char *path,
|
||||
const char *name, void *value, size_t size)
|
||||
{
|
||||
return lgetxattr(rpath(ctx, path), MAP_ACL_ACCESS, value, size);
|
||||
char buffer[PATH_MAX];
|
||||
return lgetxattr(rpath(ctx, path, buffer), MAP_ACL_ACCESS, value, size);
|
||||
}
|
||||
|
||||
static ssize_t mp_pacl_listxattr(FsContext *ctx, const char *path,
|
||||
|
@ -50,14 +51,17 @@ static ssize_t mp_pacl_listxattr(FsContext *ctx, const char *path,
|
|||
static int mp_pacl_setxattr(FsContext *ctx, const char *path, const char *name,
|
||||
void *value, size_t size, int flags)
|
||||
{
|
||||
return lsetxattr(rpath(ctx, path), MAP_ACL_ACCESS, value, size, flags);
|
||||
char buffer[PATH_MAX];
|
||||
return lsetxattr(rpath(ctx, path, buffer), MAP_ACL_ACCESS, value,
|
||||
size, flags);
|
||||
}
|
||||
|
||||
static int mp_pacl_removexattr(FsContext *ctx,
|
||||
const char *path, const char *name)
|
||||
{
|
||||
int ret;
|
||||
ret = lremovexattr(rpath(ctx, path), MAP_ACL_ACCESS);
|
||||
char buffer[PATH_MAX];
|
||||
ret = lremovexattr(rpath(ctx, path, buffer), MAP_ACL_ACCESS);
|
||||
if (ret == -1 && errno == ENODATA) {
|
||||
/*
|
||||
* We don't get ENODATA error when trying to remove a
|
||||
|
@ -73,7 +77,8 @@ static int mp_pacl_removexattr(FsContext *ctx,
|
|||
static ssize_t mp_dacl_getxattr(FsContext *ctx, const char *path,
|
||||
const char *name, void *value, size_t size)
|
||||
{
|
||||
return lgetxattr(rpath(ctx, path), MAP_ACL_DEFAULT, value, size);
|
||||
char buffer[PATH_MAX];
|
||||
return lgetxattr(rpath(ctx, path, buffer), MAP_ACL_DEFAULT, value, size);
|
||||
}
|
||||
|
||||
static ssize_t mp_dacl_listxattr(FsContext *ctx, const char *path,
|
||||
|
@ -97,14 +102,17 @@ static ssize_t mp_dacl_listxattr(FsContext *ctx, const char *path,
|
|||
static int mp_dacl_setxattr(FsContext *ctx, const char *path, const char *name,
|
||||
void *value, size_t size, int flags)
|
||||
{
|
||||
return lsetxattr(rpath(ctx, path), MAP_ACL_DEFAULT, value, size, flags);
|
||||
char buffer[PATH_MAX];
|
||||
return lsetxattr(rpath(ctx, path, buffer), MAP_ACL_DEFAULT, value,
|
||||
size, flags);
|
||||
}
|
||||
|
||||
static int mp_dacl_removexattr(FsContext *ctx,
|
||||
const char *path, const char *name)
|
||||
{
|
||||
int ret;
|
||||
ret = lremovexattr(rpath(ctx, path), MAP_ACL_DEFAULT);
|
||||
char buffer[PATH_MAX];
|
||||
ret = lremovexattr(rpath(ctx, path, buffer), MAP_ACL_DEFAULT);
|
||||
if (ret == -1 && errno == ENODATA) {
|
||||
/*
|
||||
* We don't get ENODATA error when trying to remove a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue