9p: Move a couple xattr functions to 9p-util
These functions will need custom implementations on Darwin. Since the implementation is very similar among all of them, and 9p-util already has the _nofollow version of fgetxattrat, let's move them all there. Signed-off-by: Keno Fischer <keno@juliacomputing.com> Signed-off-by: Greg Kurz <groug@kaod.org>
This commit is contained in:
parent
2306271c38
commit
ec70b956fd
@ -24,3 +24,36 @@ ssize_t fgetxattrat_nofollow(int dirfd, const char *filename, const char *name,
|
|||||||
g_free(proc_path);
|
g_free(proc_path);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ssize_t flistxattrat_nofollow(int dirfd, const char *filename,
|
||||||
|
char *list, size_t size)
|
||||||
|
{
|
||||||
|
char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename);
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = llistxattr(proc_path, list, size);
|
||||||
|
g_free(proc_path);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
ssize_t fremovexattrat_nofollow(int dirfd, const char *filename,
|
||||||
|
const char *name)
|
||||||
|
{
|
||||||
|
char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename);
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = lremovexattr(proc_path, name);
|
||||||
|
g_free(proc_path);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int fsetxattrat_nofollow(int dirfd, const char *filename, const char *name,
|
||||||
|
void *value, size_t size, int flags)
|
||||||
|
{
|
||||||
|
char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename);
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = lsetxattr(proc_path, name, value, size, flags);
|
||||||
|
g_free(proc_path);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
@ -60,5 +60,9 @@ ssize_t fgetxattrat_nofollow(int dirfd, const char *path, const char *name,
|
|||||||
void *value, size_t size);
|
void *value, size_t size);
|
||||||
int fsetxattrat_nofollow(int dirfd, const char *path, const char *name,
|
int fsetxattrat_nofollow(int dirfd, const char *path, const char *name,
|
||||||
void *value, size_t size, int flags);
|
void *value, size_t size, int flags);
|
||||||
|
ssize_t flistxattrat_nofollow(int dirfd, const char *filename,
|
||||||
|
char *list, size_t size);
|
||||||
|
ssize_t fremovexattrat_nofollow(int dirfd, const char *filename,
|
||||||
|
const char *name);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -60,17 +60,6 @@ ssize_t pt_listxattr(FsContext *ctx, const char *path,
|
|||||||
return name_size;
|
return name_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t flistxattrat_nofollow(int dirfd, const char *filename,
|
|
||||||
char *list, size_t size)
|
|
||||||
{
|
|
||||||
char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename);
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = llistxattr(proc_path, list, size);
|
|
||||||
g_free(proc_path);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the list and pass to each layer to find out whether
|
* Get the list and pass to each layer to find out whether
|
||||||
* to send the data or not
|
* to send the data or not
|
||||||
@ -196,17 +185,6 @@ ssize_t pt_getxattr(FsContext *ctx, const char *path, const char *name,
|
|||||||
return local_getxattr_nofollow(ctx, path, name, value, size);
|
return local_getxattr_nofollow(ctx, path, name, value, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
int fsetxattrat_nofollow(int dirfd, const char *filename, const char *name,
|
|
||||||
void *value, size_t size, int flags)
|
|
||||||
{
|
|
||||||
char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename);
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = lsetxattr(proc_path, name, value, size, flags);
|
|
||||||
g_free(proc_path);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ssize_t local_setxattr_nofollow(FsContext *ctx, const char *path,
|
ssize_t local_setxattr_nofollow(FsContext *ctx, const char *path,
|
||||||
const char *name, void *value, size_t size,
|
const char *name, void *value, size_t size,
|
||||||
int flags)
|
int flags)
|
||||||
@ -235,17 +213,6 @@ int pt_setxattr(FsContext *ctx, const char *path, const char *name, void *value,
|
|||||||
return local_setxattr_nofollow(ctx, path, name, value, size, flags);
|
return local_setxattr_nofollow(ctx, path, name, value, size, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t fremovexattrat_nofollow(int dirfd, const char *filename,
|
|
||||||
const char *name)
|
|
||||||
{
|
|
||||||
char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename);
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = lremovexattr(proc_path, name);
|
|
||||||
g_free(proc_path);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ssize_t local_removexattr_nofollow(FsContext *ctx, const char *path,
|
ssize_t local_removexattr_nofollow(FsContext *ctx, const char *path,
|
||||||
const char *name)
|
const char *name)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user