* [PATCH 0/2] adding libceph xattr support
@ 2011-05-10 19:38 Brian Chrisman
2011-05-10 19:38 ` [PATCH 1/2] support for xattrs in libceph Brian Chrisman
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Brian Chrisman @ 2011-05-10 19:38 UTC (permalink / raw)
To: ceph-devel; +Cc: Brian Chrisman
Expands libceph to handle xattr calls including underlying Client methods.
testceph is expanded to verify libceph xattr calls work.
Brian Chrisman (2):
support for xattrs in libceph
expand testceph to check xattrs
src/client/Client.cc | 67 +++++++++++++++++++++++++++++++++++++++-
src/client/Client.h | 10 ++++++
src/client/testceph.cc | 74 +++++++++++++++++++++++++++++++++++++++++++-
src/include/ceph/libceph.h | 15 +++++++++
src/libceph.cc | 42 +++++++++++++++++++++++++
5 files changed, 206 insertions(+), 2 deletions(-)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/2] support for xattrs in libceph
2011-05-10 19:38 [PATCH 0/2] adding libceph xattr support Brian Chrisman
@ 2011-05-10 19:38 ` Brian Chrisman
2011-05-10 19:44 ` Gregory Farnum
2011-05-10 20:30 ` Yehuda Sadeh Weinraub
2011-05-10 19:38 ` [PATCH 2/2] expand testceph to check xattrs Brian Chrisman
2011-05-11 17:29 ` [PATCH 0/2] adding libceph xattr support Sage Weil
2 siblings, 2 replies; 10+ messages in thread
From: Brian Chrisman @ 2011-05-10 19:38 UTC (permalink / raw)
To: ceph-devel; +Cc: Brian Chrisman, Brian Chrisman
From: Brian Chrisman <bchrisman@gmail.com>
Signed-off-by: Brian Chrisman <brchrisman@gmail.com>
---
src/client/Client.cc | 67 +++++++++++++++++++++++++++++++++++++++++++-
src/client/Client.h | 10 ++++++
src/include/ceph/libceph.h | 15 ++++++++++
src/libceph.cc | 42 +++++++++++++++++++++++++++
4 files changed, 133 insertions(+), 1 deletions(-)
diff --git a/src/client/Client.cc b/src/client/Client.cc
index 6a27273..5083e99 100644
--- a/src/client/Client.cc
+++ b/src/client/Client.cc
@@ -5563,6 +5563,71 @@ int Client::ll_setattr(vinodeno_t vino, struct stat *attr, int mask, int uid, in
// ----------
// xattrs
+int Client::getxattr(const char *path, const char *name, void *value, size_t size)
+{
+ Mutex::Locker lock(client_lock);
+ Inode *ceph_inode;
+ Client::path_walk(path, &ceph_inode, true);
+ return Client::_getxattr(ceph_inode, name, value, size, getuid(), getgid());
+}
+
+int Client::lgetxattr(const char *path, const char *name, void *value, size_t size)
+{
+ Mutex::Locker lock(client_lock);
+ Inode *ceph_inode;
+ Client::path_walk(path, &ceph_inode, false);
+ return Client::_getxattr(ceph_inode, name, value, size, getuid(), getgid());
+}
+
+int Client::listxattr(const char *path, char *list, size_t size)
+{
+ Mutex::Locker lock(client_lock);
+ Inode *ceph_inode;
+ Client::path_walk(path, &ceph_inode, true);
+ return Client::_listxattr(ceph_inode, list, size, getuid(), getgid());
+}
+
+int Client::llistxattr(const char *path, char *list, size_t size)
+{
+ Mutex::Locker lock(client_lock);
+ Inode *ceph_inode;
+ Client::path_walk(path, &ceph_inode, false);
+ return Client::_listxattr(ceph_inode, list, size, getuid(), getgid());
+}
+
+int Client::removexattr(const char *path, const char *name)
+{
+ Mutex::Locker lock(client_lock);
+ Inode *ceph_inode;
+ Client::path_walk(path, &ceph_inode, true);
+ return Client::_removexattr(ceph_inode, name, getuid(), getgid());
+}
+
+int Client::lremovexattr(const char *path, const char *name)
+{
+ Mutex::Locker lock(client_lock);
+ Inode *ceph_inode;
+ Client::path_walk(path, &ceph_inode, false);
+ return Client::_removexattr(ceph_inode, name, getuid(), getgid());
+}
+
+int Client::setxattr(const char *path, const char *name, const void *value, size_t size, int flags)
+{
+ Mutex::Locker lock(client_lock);
+ Inode *ceph_inode;
+ Client::path_walk(path, &ceph_inode, true);
+ return Client::_setxattr(ceph_inode, name, value, size, flags, getuid(), getgid());
+}
+
+int Client::lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags)
+{
+ Mutex::Locker lock(client_lock);
+ Inode *ceph_inode;
+ Client::path_walk(path, &ceph_inode, false);
+ return Client::_setxattr(ceph_inode, name, value, size, flags, getuid(), getgid());
+}
+
+
int Client::_getxattr(Inode *in, const char *name, void *value, size_t size,
int uid, int gid)
{
@@ -5708,7 +5773,7 @@ int Client::ll_removexattr(vinodeno_t vino, const char *name, int uid, int gid)
tout << name << std::endl;
// only user xattrs, for now
- if (strncmp(name, "user.", 5))
+ if (strncmp(name, "user.", 5) && strncmp(name, "security.", 9) && strncmp(name, "trusted.", 8))
return -EOPNOTSUPP;
Inode *in = _ll_get_inode(vino);
diff --git a/src/client/Client.h b/src/client/Client.h
index ab21dc8..b36621d 100644
--- a/src/client/Client.h
+++ b/src/client/Client.h
@@ -1258,6 +1258,16 @@ public:
int fsync(int fd, bool syncdataonly);
int fstat(int fd, struct stat *stbuf);
+ // full path xattr ops
+ int getxattr(const char *path, const char *name, void *value, size_t size);
+ int lgetxattr(const char *path, const char *name, void *value, size_t size);
+ int listxattr(const char *path, char *list, size_t size);
+ int llistxattr(const char *path, char *list, size_t size);
+ int removexattr(const char *path, const char *name);
+ int lremovexattr(const char *path, const char *name);
+ int setxattr(const char *path, const char *name, const void *value, size_t size, int flags);
+ int lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags);
+
int sync_fs();
int64_t drop_caches();
diff --git a/src/include/ceph/libceph.h b/src/include/ceph/libceph.h
index 3ed3369..f9fc29e 100644
--- a/src/include/ceph/libceph.h
+++ b/src/include/ceph/libceph.h
@@ -121,6 +121,21 @@ int ceph_fstat(struct ceph_mount_info *cmount, int fd, struct stat *stbuf);
int ceph_sync_fs(struct ceph_mount_info *cmount);
+/* xattr support */
+int ceph_getxattr(struct ceph_mount_info *cmount, const char *path, const char *name,
+ void *value, size_t size);
+int ceph_lgetxattr(struct ceph_mount_info *cmount, const char *path, const char *name,
+ void *value, size_t size);
+int ceph_listxattr(struct ceph_mount_info *cmount, const char *path, char *list, size_t size);
+int ceph_llistxattr(struct ceph_mount_info *cmount, const char *path, char *list, size_t size);
+int ceph_removexattr(struct ceph_mount_info *cmount, const char *path, const char *name);
+int ceph_lremovexattr(struct ceph_mount_info *cmount, const char *path, const char *name);
+int ceph_setxattr(struct ceph_mount_info *cmount, const char *path, const char *name,
+ const void *value, size_t size, int flags);
+int ceph_lsetxattr(struct ceph_mount_info *cmount, const char *path, const char *name,
+ const void *value, size_t size, int flags);
+
+
/* expose file layout */
int ceph_get_file_stripe_unit(struct ceph_mount_info *cmount, int fh);
diff --git a/src/libceph.cc b/src/libceph.cc
index d1143d6..6388bde 100644
--- a/src/libceph.cc
+++ b/src/libceph.cc
@@ -416,6 +416,48 @@ extern "C" int ceph_setattr(struct ceph_mount_info *cmount, const char *relpath,
return cmount->get_client()->setattr(relpath, attr, mask);
}
+// *xattr() calls supporting samba/vfs
+extern "C" int ceph_getxattr(struct ceph_mount_info *cmount, const char *path, const char *name, void *value, size_t size)
+{
+ return cmount->get_client()->getxattr(path, name, value, size);
+}
+
+extern "C" int ceph_lgetxattr(struct ceph_mount_info *cmount, const char *path, const char *name, void *value, size_t size)
+{
+ return cmount->get_client()->lgetxattr(path, name, value, size);
+}
+
+extern "C" int ceph_listxattr(struct ceph_mount_info *cmount, const char *path, char *list, size_t size)
+{
+ return cmount->get_client()->listxattr(path, list, size);
+}
+
+extern "C" int ceph_llistxattr(struct ceph_mount_info *cmount, const char *path, char *list, size_t size)
+{
+ return cmount->get_client()->llistxattr(path, list, size);
+}
+
+extern "C" int ceph_removexattr(struct ceph_mount_info *cmount, const char *path, const char *name)
+{
+ return cmount->get_client()->removexattr(path, name);
+}
+
+extern "C" int ceph_lremovexattr(struct ceph_mount_info *cmount, const char *path, const char *name)
+{
+ return cmount->get_client()->lremovexattr(path, name);
+}
+
+extern "C" int ceph_setxattr(struct ceph_mount_info *cmount, const char *path, const char *name, const void *value, size_t size, int flags)
+{
+ return cmount->get_client()->setxattr(path, name, value, size, flags);
+}
+
+extern "C" int ceph_lsetxattr(struct ceph_mount_info *cmount, const char *path, const char *name, const void *value, size_t size, int flags)
+{
+ return cmount->get_client()->lsetxattr(path, name, value, size, flags);
+}
+/* end xattr support */
+
extern "C" int ceph_chmod(struct ceph_mount_info *cmount, const char *path, mode_t mode)
{
return cmount->get_client()->chmod(path, mode);
--
1.7.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/2] expand testceph to check xattrs
2011-05-10 19:38 [PATCH 0/2] adding libceph xattr support Brian Chrisman
2011-05-10 19:38 ` [PATCH 1/2] support for xattrs in libceph Brian Chrisman
@ 2011-05-10 19:38 ` Brian Chrisman
2011-05-11 17:29 ` [PATCH 0/2] adding libceph xattr support Sage Weil
2 siblings, 0 replies; 10+ messages in thread
From: Brian Chrisman @ 2011-05-10 19:38 UTC (permalink / raw)
To: ceph-devel; +Cc: Brian Chrisman
Signed-off-by: Brian Chrisman <brchrisman@gmail.com>
---
src/client/testceph.cc | 74 +++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 73 insertions(+), 1 deletions(-)
diff --git a/src/client/testceph.cc b/src/client/testceph.cc
index 1bbd81d..da4b7a2 100644
--- a/src/client/testceph.cc
+++ b/src/client/testceph.cc
@@ -14,9 +14,13 @@
#include "common/errno.h"
#include "include/ceph/libceph.h"
+#include <stdlib.h>
#include <errno.h>
#include <iostream>
+#include <fcntl.h>
+#include <sys/xattr.h>
+#include <string.h>
using std::cout;
using std::cerr;
@@ -24,16 +28,19 @@ using std::cerr;
int main(int argc, const char **argv)
{
struct ceph_mount_info *cmount;
+ cout << "calling ceph_create..." << std::endl;
int ret = ceph_create(&cmount, NULL);
if (ret) {
cerr << "ceph_create failed with error: " << ret << std::endl;
return 1;
}
-
+ cout << "calling ceph_conf_read_file..." << ret << std::endl;
ceph_conf_read_file(cmount, NULL);
+ cout << "calling ceph_conf_parse_argv..." << ret << std::endl;
ceph_conf_parse_argv(cmount, argc, argv);
char buf[128];
+ cout << "calling ceph_conf_get..." << ret << std::endl;
ret = ceph_conf_get(cmount, "log file", buf, sizeof(buf));
if (ret) {
cerr << "ceph_conf_get(\"log file\") failed with error " << ret << std::endl;
@@ -49,18 +56,23 @@ int main(int argc, const char **argv)
}
cout << "Successfully mounted Ceph!" << std::endl;
+ // what if foo is already there???
struct ceph_dir_result *foo_dir;
ret = ceph_opendir(cmount, "foo", &foo_dir);
if (ret != -ENOENT) {
cerr << "ceph_opendir error: unexpected result from trying to open foo: "
<< cpp_strerror(ret) << std::endl;
return 1;
+ } else {
+ cout << "ceph_opendir: success" << std::endl;
}
ret = ceph_mkdir(cmount, "foo", 0777);
if (ret) {
cerr << "ceph_mkdir error: " << cpp_strerror(ret) << std::endl;
return 1;
+ } else {
+ cout << "ceph_mkdir: success" << std::endl;
}
struct stat stbuf;
@@ -68,39 +80,99 @@ int main(int argc, const char **argv)
if (ret) {
cerr << "ceph_lstat error: " << cpp_strerror(ret) << std::endl;
return 1;
+ } else {
+ cout << "ceph_lstat: success" << std::endl;
}
if (!S_ISDIR(stbuf.st_mode)) {
cerr << "ceph_lstat(foo): foo is not a directory? st_mode = "
<< stbuf.st_mode << std::endl;
return 1;
+ } else {
+ cout << "ceph_lstat: mode success" << std::endl;
}
ret = ceph_rmdir(cmount, "foo");
if (ret) {
cerr << "ceph_rmdir error: " << cpp_strerror(ret) << std::endl;
return 1;
+ } else {
+ cout << "ceph_rmdir: success" << std::endl;
}
ret = ceph_mkdirs(cmount, "foo/bar/baz", 0777);
if (ret) {
cerr << "ceph_mkdirs error: " << cpp_strerror(ret) << std::endl;
return 1;
+ } else {
+ cout << "ceph_mkdirs: success" << std::endl;
}
ret = ceph_rmdir(cmount, "foo/bar/baz");
if (ret) {
cerr << "ceph_rmdir error: " << cpp_strerror(ret) << std::endl;
return 1;
+ } else {
+ cout << "ceph_rmdir: success" << std::endl;
}
ret = ceph_rmdir(cmount, "foo/bar");
if (ret) {
cerr << "ceph_rmdir error: " << cpp_strerror(ret) << std::endl;
return 1;
+ } else {
+ cout << "ceph_rmdir: success" << std::endl;
}
ret = ceph_rmdir(cmount, "foo");
if (ret) {
cerr << "ceph_rmdir error: " << cpp_strerror(ret) << std::endl;
return 1;
+ } else {
+ cout << "ceph_rmdir: success" << std::endl;
+ }
+ ret = ceph_open(cmount, "barfile", O_CREAT, 0666);
+ if (ret < 0) {
+ cerr << "ceph_open O_CREAT error: " << cpp_strerror(ret) << std::endl;
+ return 1;
+ } else {
+ cout << "ceph_open: success" << std::endl;
+ }
+ ret = ceph_setxattr(cmount, "barfile", "user.testxattr", (void *) "AYBABTU", 7, XATTR_CREATE);
+ if (ret < 0) {
+ cerr << "ceph_setxattr error: " << cpp_strerror(ret) << std::endl;
+ return 1;
+ } else {
+ cout << "ceph_setxattr: success" << std::endl;
+ }
+ char *outlist;
+ outlist = (char *) malloc(256);
+ ret = ceph_listxattr(cmount, "barfile", outlist, 0);
+ free(outlist);
+ if (ret < 1) {
+ cerr << "ceph_listxattr error (a): should have returned > 0" << cpp_strerror(ret) << std::endl;
+ return 1;
+ } else {
+ cout << "ceph_listxattr: success" << std::endl;
+ }
+
+ outlist = (char *) malloc(ret);
+ ret = ceph_listxattr(cmount, "barfile", outlist, ret);
+ if (ret < 1) {
+ cerr << "ceph_listxattr error (b): should have returned > 0" << cpp_strerror(ret) << std::endl;
+ return 1;
+ } else {
+ cout << "ceph_listxattr: success" << std::endl;
+ }
+ void *aybabtu;
+ aybabtu = malloc(8);
+ ret = ceph_getxattr(cmount, "barfile", "user.testxattr", aybabtu, 7);
+ if (ret < 1) {
+ cerr << "ceph_getxattr error: " << cpp_strerror(ret) << std::endl;
+ return 1;
+ } else {
+ cout << "ceph_getxattr: success" << std::endl;
+ }
+ char aybabtu_reference[]="AYBABTU";
+ if (strncmp((char *) aybabtu, aybabtu_reference,7)) {
+ cerr << "ceph_getxattr error: no match (" << aybabtu << ") should be (" << aybabtu_reference << cpp_strerror(ret) << std::endl;
}
ceph_shutdown(cmount);
--
1.7.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] support for xattrs in libceph
2011-05-10 19:38 ` [PATCH 1/2] support for xattrs in libceph Brian Chrisman
@ 2011-05-10 19:44 ` Gregory Farnum
2011-05-10 20:22 ` Brian Chrisman
2011-05-10 20:30 ` Yehuda Sadeh Weinraub
1 sibling, 1 reply; 10+ messages in thread
From: Gregory Farnum @ 2011-05-10 19:44 UTC (permalink / raw)
To: Brian Chrisman; +Cc: ceph-devel
What are the 'l'-prefixed functions for? They look like they're just
duplicates except for the prefix.
-Greg
On Tue, May 10, 2011 at 12:38 PM, Brian Chrisman <brchrisman@gmail.com> wrote:
> From: Brian Chrisman <bchrisman@gmail.com>
>
>
> Signed-off-by: Brian Chrisman <brchrisman@gmail.com>
> ---
> src/client/Client.cc | 67 +++++++++++++++++++++++++++++++++++++++++++-
> src/client/Client.h | 10 ++++++
> src/include/ceph/libceph.h | 15 ++++++++++
> src/libceph.cc | 42 +++++++++++++++++++++++++++
> 4 files changed, 133 insertions(+), 1 deletions(-)
>
> diff --git a/src/client/Client.cc b/src/client/Client.cc
> index 6a27273..5083e99 100644
> --- a/src/client/Client.cc
> +++ b/src/client/Client.cc
> @@ -5563,6 +5563,71 @@ int Client::ll_setattr(vinodeno_t vino, struct stat *attr, int mask, int uid, in
> // ----------
> // xattrs
>
> +int Client::getxattr(const char *path, const char *name, void *value, size_t size)
> +{
> + Mutex::Locker lock(client_lock);
> + Inode *ceph_inode;
> + Client::path_walk(path, &ceph_inode, true);
> + return Client::_getxattr(ceph_inode, name, value, size, getuid(), getgid());
> +}
> +
> +int Client::lgetxattr(const char *path, const char *name, void *value, size_t size)
> +{
> + Mutex::Locker lock(client_lock);
> + Inode *ceph_inode;
> + Client::path_walk(path, &ceph_inode, false);
> + return Client::_getxattr(ceph_inode, name, value, size, getuid(), getgid());
> +}
> +
> +int Client::listxattr(const char *path, char *list, size_t size)
> +{
> + Mutex::Locker lock(client_lock);
> + Inode *ceph_inode;
> + Client::path_walk(path, &ceph_inode, true);
> + return Client::_listxattr(ceph_inode, list, size, getuid(), getgid());
> +}
> +
> +int Client::llistxattr(const char *path, char *list, size_t size)
> +{
> + Mutex::Locker lock(client_lock);
> + Inode *ceph_inode;
> + Client::path_walk(path, &ceph_inode, false);
> + return Client::_listxattr(ceph_inode, list, size, getuid(), getgid());
> +}
> +
> +int Client::removexattr(const char *path, const char *name)
> +{
> + Mutex::Locker lock(client_lock);
> + Inode *ceph_inode;
> + Client::path_walk(path, &ceph_inode, true);
> + return Client::_removexattr(ceph_inode, name, getuid(), getgid());
> +}
> +
> +int Client::lremovexattr(const char *path, const char *name)
> +{
> + Mutex::Locker lock(client_lock);
> + Inode *ceph_inode;
> + Client::path_walk(path, &ceph_inode, false);
> + return Client::_removexattr(ceph_inode, name, getuid(), getgid());
> +}
> +
> +int Client::setxattr(const char *path, const char *name, const void *value, size_t size, int flags)
> +{
> + Mutex::Locker lock(client_lock);
> + Inode *ceph_inode;
> + Client::path_walk(path, &ceph_inode, true);
> + return Client::_setxattr(ceph_inode, name, value, size, flags, getuid(), getgid());
> +}
> +
> +int Client::lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags)
> +{
> + Mutex::Locker lock(client_lock);
> + Inode *ceph_inode;
> + Client::path_walk(path, &ceph_inode, false);
> + return Client::_setxattr(ceph_inode, name, value, size, flags, getuid(), getgid());
> +}
> +
> +
> int Client::_getxattr(Inode *in, const char *name, void *value, size_t size,
> int uid, int gid)
> {
> @@ -5708,7 +5773,7 @@ int Client::ll_removexattr(vinodeno_t vino, const char *name, int uid, int gid)
> tout << name << std::endl;
>
> // only user xattrs, for now
> - if (strncmp(name, "user.", 5))
> + if (strncmp(name, "user.", 5) && strncmp(name, "security.", 9) && strncmp(name, "trusted.", 8))
> return -EOPNOTSUPP;
>
> Inode *in = _ll_get_inode(vino);
> diff --git a/src/client/Client.h b/src/client/Client.h
> index ab21dc8..b36621d 100644
> --- a/src/client/Client.h
> +++ b/src/client/Client.h
> @@ -1258,6 +1258,16 @@ public:
> int fsync(int fd, bool syncdataonly);
> int fstat(int fd, struct stat *stbuf);
>
> + // full path xattr ops
> + int getxattr(const char *path, const char *name, void *value, size_t size);
> + int lgetxattr(const char *path, const char *name, void *value, size_t size);
> + int listxattr(const char *path, char *list, size_t size);
> + int llistxattr(const char *path, char *list, size_t size);
> + int removexattr(const char *path, const char *name);
> + int lremovexattr(const char *path, const char *name);
> + int setxattr(const char *path, const char *name, const void *value, size_t size, int flags);
> + int lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags);
> +
> int sync_fs();
> int64_t drop_caches();
>
> diff --git a/src/include/ceph/libceph.h b/src/include/ceph/libceph.h
> index 3ed3369..f9fc29e 100644
> --- a/src/include/ceph/libceph.h
> +++ b/src/include/ceph/libceph.h
> @@ -121,6 +121,21 @@ int ceph_fstat(struct ceph_mount_info *cmount, int fd, struct stat *stbuf);
>
> int ceph_sync_fs(struct ceph_mount_info *cmount);
>
> +/* xattr support */
> +int ceph_getxattr(struct ceph_mount_info *cmount, const char *path, const char *name,
> + void *value, size_t size);
> +int ceph_lgetxattr(struct ceph_mount_info *cmount, const char *path, const char *name,
> + void *value, size_t size);
> +int ceph_listxattr(struct ceph_mount_info *cmount, const char *path, char *list, size_t size);
> +int ceph_llistxattr(struct ceph_mount_info *cmount, const char *path, char *list, size_t size);
> +int ceph_removexattr(struct ceph_mount_info *cmount, const char *path, const char *name);
> +int ceph_lremovexattr(struct ceph_mount_info *cmount, const char *path, const char *name);
> +int ceph_setxattr(struct ceph_mount_info *cmount, const char *path, const char *name,
> + const void *value, size_t size, int flags);
> +int ceph_lsetxattr(struct ceph_mount_info *cmount, const char *path, const char *name,
> + const void *value, size_t size, int flags);
> +
> +
>
> /* expose file layout */
> int ceph_get_file_stripe_unit(struct ceph_mount_info *cmount, int fh);
> diff --git a/src/libceph.cc b/src/libceph.cc
> index d1143d6..6388bde 100644
> --- a/src/libceph.cc
> +++ b/src/libceph.cc
> @@ -416,6 +416,48 @@ extern "C" int ceph_setattr(struct ceph_mount_info *cmount, const char *relpath,
> return cmount->get_client()->setattr(relpath, attr, mask);
> }
>
> +// *xattr() calls supporting samba/vfs
> +extern "C" int ceph_getxattr(struct ceph_mount_info *cmount, const char *path, const char *name, void *value, size_t size)
> +{
> + return cmount->get_client()->getxattr(path, name, value, size);
> +}
> +
> +extern "C" int ceph_lgetxattr(struct ceph_mount_info *cmount, const char *path, const char *name, void *value, size_t size)
> +{
> + return cmount->get_client()->lgetxattr(path, name, value, size);
> +}
> +
> +extern "C" int ceph_listxattr(struct ceph_mount_info *cmount, const char *path, char *list, size_t size)
> +{
> + return cmount->get_client()->listxattr(path, list, size);
> +}
> +
> +extern "C" int ceph_llistxattr(struct ceph_mount_info *cmount, const char *path, char *list, size_t size)
> +{
> + return cmount->get_client()->llistxattr(path, list, size);
> +}
> +
> +extern "C" int ceph_removexattr(struct ceph_mount_info *cmount, const char *path, const char *name)
> +{
> + return cmount->get_client()->removexattr(path, name);
> +}
> +
> +extern "C" int ceph_lremovexattr(struct ceph_mount_info *cmount, const char *path, const char *name)
> +{
> + return cmount->get_client()->lremovexattr(path, name);
> +}
> +
> +extern "C" int ceph_setxattr(struct ceph_mount_info *cmount, const char *path, const char *name, const void *value, size_t size, int flags)
> +{
> + return cmount->get_client()->setxattr(path, name, value, size, flags);
> +}
> +
> +extern "C" int ceph_lsetxattr(struct ceph_mount_info *cmount, const char *path, const char *name, const void *value, size_t size, int flags)
> +{
> + return cmount->get_client()->lsetxattr(path, name, value, size, flags);
> +}
> +/* end xattr support */
> +
> extern "C" int ceph_chmod(struct ceph_mount_info *cmount, const char *path, mode_t mode)
> {
> return cmount->get_client()->chmod(path, mode);
> --
> 1.7.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] support for xattrs in libceph
2011-05-10 19:44 ` Gregory Farnum
@ 2011-05-10 20:22 ` Brian Chrisman
2011-05-10 20:28 ` Gregory Farnum
0 siblings, 1 reply; 10+ messages in thread
From: Brian Chrisman @ 2011-05-10 20:22 UTC (permalink / raw)
To: Gregory Farnum; +Cc: ceph-devel
They differentiate between xattrs on symlinks or on the files at which
they point.
If I recall, it's a slight difference internally to the Client class
whether a value is passed to path_walk as true/false, though I may be
misinterpreting that. I can look at that again.
On Tue, May 10, 2011 at 12:44 PM, Gregory Farnum <gregf@hq.newdream.net> wrote:
> What are the 'l'-prefixed functions for? They look like they're just
> duplicates except for the prefix.
> -Greg
>
> On Tue, May 10, 2011 at 12:38 PM, Brian Chrisman <brchrisman@gmail.com> wrote:
>> From: Brian Chrisman <bchrisman@gmail.com>
>>
>>
>> Signed-off-by: Brian Chrisman <brchrisman@gmail.com>
>> ---
>> src/client/Client.cc | 67 +++++++++++++++++++++++++++++++++++++++++++-
>> src/client/Client.h | 10 ++++++
>> src/include/ceph/libceph.h | 15 ++++++++++
>> src/libceph.cc | 42 +++++++++++++++++++++++++++
>> 4 files changed, 133 insertions(+), 1 deletions(-)
>>
>> diff --git a/src/client/Client.cc b/src/client/Client.cc
>> index 6a27273..5083e99 100644
>> --- a/src/client/Client.cc
>> +++ b/src/client/Client.cc
>> @@ -5563,6 +5563,71 @@ int Client::ll_setattr(vinodeno_t vino, struct stat *attr, int mask, int uid, in
>> // ----------
>> // xattrs
>>
>> +int Client::getxattr(const char *path, const char *name, void *value, size_t size)
>> +{
>> + Mutex::Locker lock(client_lock);
>> + Inode *ceph_inode;
>> + Client::path_walk(path, &ceph_inode, true);
>> + return Client::_getxattr(ceph_inode, name, value, size, getuid(), getgid());
>> +}
>> +
>> +int Client::lgetxattr(const char *path, const char *name, void *value, size_t size)
>> +{
>> + Mutex::Locker lock(client_lock);
>> + Inode *ceph_inode;
>> + Client::path_walk(path, &ceph_inode, false);
>> + return Client::_getxattr(ceph_inode, name, value, size, getuid(), getgid());
>> +}
>> +
>> +int Client::listxattr(const char *path, char *list, size_t size)
>> +{
>> + Mutex::Locker lock(client_lock);
>> + Inode *ceph_inode;
>> + Client::path_walk(path, &ceph_inode, true);
>> + return Client::_listxattr(ceph_inode, list, size, getuid(), getgid());
>> +}
>> +
>> +int Client::llistxattr(const char *path, char *list, size_t size)
>> +{
>> + Mutex::Locker lock(client_lock);
>> + Inode *ceph_inode;
>> + Client::path_walk(path, &ceph_inode, false);
>> + return Client::_listxattr(ceph_inode, list, size, getuid(), getgid());
>> +}
>> +
>> +int Client::removexattr(const char *path, const char *name)
>> +{
>> + Mutex::Locker lock(client_lock);
>> + Inode *ceph_inode;
>> + Client::path_walk(path, &ceph_inode, true);
>> + return Client::_removexattr(ceph_inode, name, getuid(), getgid());
>> +}
>> +
>> +int Client::lremovexattr(const char *path, const char *name)
>> +{
>> + Mutex::Locker lock(client_lock);
>> + Inode *ceph_inode;
>> + Client::path_walk(path, &ceph_inode, false);
>> + return Client::_removexattr(ceph_inode, name, getuid(), getgid());
>> +}
>> +
>> +int Client::setxattr(const char *path, const char *name, const void *value, size_t size, int flags)
>> +{
>> + Mutex::Locker lock(client_lock);
>> + Inode *ceph_inode;
>> + Client::path_walk(path, &ceph_inode, true);
>> + return Client::_setxattr(ceph_inode, name, value, size, flags, getuid(), getgid());
>> +}
>> +
>> +int Client::lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags)
>> +{
>> + Mutex::Locker lock(client_lock);
>> + Inode *ceph_inode;
>> + Client::path_walk(path, &ceph_inode, false);
>> + return Client::_setxattr(ceph_inode, name, value, size, flags, getuid(), getgid());
>> +}
>> +
>> +
>> int Client::_getxattr(Inode *in, const char *name, void *value, size_t size,
>> int uid, int gid)
>> {
>> @@ -5708,7 +5773,7 @@ int Client::ll_removexattr(vinodeno_t vino, const char *name, int uid, int gid)
>> tout << name << std::endl;
>>
>> // only user xattrs, for now
>> - if (strncmp(name, "user.", 5))
>> + if (strncmp(name, "user.", 5) && strncmp(name, "security.", 9) && strncmp(name, "trusted.", 8))
>> return -EOPNOTSUPP;
>>
>> Inode *in = _ll_get_inode(vino);
>> diff --git a/src/client/Client.h b/src/client/Client.h
>> index ab21dc8..b36621d 100644
>> --- a/src/client/Client.h
>> +++ b/src/client/Client.h
>> @@ -1258,6 +1258,16 @@ public:
>> int fsync(int fd, bool syncdataonly);
>> int fstat(int fd, struct stat *stbuf);
>>
>> + // full path xattr ops
>> + int getxattr(const char *path, const char *name, void *value, size_t size);
>> + int lgetxattr(const char *path, const char *name, void *value, size_t size);
>> + int listxattr(const char *path, char *list, size_t size);
>> + int llistxattr(const char *path, char *list, size_t size);
>> + int removexattr(const char *path, const char *name);
>> + int lremovexattr(const char *path, const char *name);
>> + int setxattr(const char *path, const char *name, const void *value, size_t size, int flags);
>> + int lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags);
>> +
>> int sync_fs();
>> int64_t drop_caches();
>>
>> diff --git a/src/include/ceph/libceph.h b/src/include/ceph/libceph.h
>> index 3ed3369..f9fc29e 100644
>> --- a/src/include/ceph/libceph.h
>> +++ b/src/include/ceph/libceph.h
>> @@ -121,6 +121,21 @@ int ceph_fstat(struct ceph_mount_info *cmount, int fd, struct stat *stbuf);
>>
>> int ceph_sync_fs(struct ceph_mount_info *cmount);
>>
>> +/* xattr support */
>> +int ceph_getxattr(struct ceph_mount_info *cmount, const char *path, const char *name,
>> + void *value, size_t size);
>> +int ceph_lgetxattr(struct ceph_mount_info *cmount, const char *path, const char *name,
>> + void *value, size_t size);
>> +int ceph_listxattr(struct ceph_mount_info *cmount, const char *path, char *list, size_t size);
>> +int ceph_llistxattr(struct ceph_mount_info *cmount, const char *path, char *list, size_t size);
>> +int ceph_removexattr(struct ceph_mount_info *cmount, const char *path, const char *name);
>> +int ceph_lremovexattr(struct ceph_mount_info *cmount, const char *path, const char *name);
>> +int ceph_setxattr(struct ceph_mount_info *cmount, const char *path, const char *name,
>> + const void *value, size_t size, int flags);
>> +int ceph_lsetxattr(struct ceph_mount_info *cmount, const char *path, const char *name,
>> + const void *value, size_t size, int flags);
>> +
>> +
>>
>> /* expose file layout */
>> int ceph_get_file_stripe_unit(struct ceph_mount_info *cmount, int fh);
>> diff --git a/src/libceph.cc b/src/libceph.cc
>> index d1143d6..6388bde 100644
>> --- a/src/libceph.cc
>> +++ b/src/libceph.cc
>> @@ -416,6 +416,48 @@ extern "C" int ceph_setattr(struct ceph_mount_info *cmount, const char *relpath,
>> return cmount->get_client()->setattr(relpath, attr, mask);
>> }
>>
>> +// *xattr() calls supporting samba/vfs
>> +extern "C" int ceph_getxattr(struct ceph_mount_info *cmount, const char *path, const char *name, void *value, size_t size)
>> +{
>> + return cmount->get_client()->getxattr(path, name, value, size);
>> +}
>> +
>> +extern "C" int ceph_lgetxattr(struct ceph_mount_info *cmount, const char *path, const char *name, void *value, size_t size)
>> +{
>> + return cmount->get_client()->lgetxattr(path, name, value, size);
>> +}
>> +
>> +extern "C" int ceph_listxattr(struct ceph_mount_info *cmount, const char *path, char *list, size_t size)
>> +{
>> + return cmount->get_client()->listxattr(path, list, size);
>> +}
>> +
>> +extern "C" int ceph_llistxattr(struct ceph_mount_info *cmount, const char *path, char *list, size_t size)
>> +{
>> + return cmount->get_client()->llistxattr(path, list, size);
>> +}
>> +
>> +extern "C" int ceph_removexattr(struct ceph_mount_info *cmount, const char *path, const char *name)
>> +{
>> + return cmount->get_client()->removexattr(path, name);
>> +}
>> +
>> +extern "C" int ceph_lremovexattr(struct ceph_mount_info *cmount, const char *path, const char *name)
>> +{
>> + return cmount->get_client()->lremovexattr(path, name);
>> +}
>> +
>> +extern "C" int ceph_setxattr(struct ceph_mount_info *cmount, const char *path, const char *name, const void *value, size_t size, int flags)
>> +{
>> + return cmount->get_client()->setxattr(path, name, value, size, flags);
>> +}
>> +
>> +extern "C" int ceph_lsetxattr(struct ceph_mount_info *cmount, const char *path, const char *name, const void *value, size_t size, int flags)
>> +{
>> + return cmount->get_client()->lsetxattr(path, name, value, size, flags);
>> +}
>> +/* end xattr support */
>> +
>> extern "C" int ceph_chmod(struct ceph_mount_info *cmount, const char *path, mode_t mode)
>> {
>> return cmount->get_client()->chmod(path, mode);
>> --
>> 1.7.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] support for xattrs in libceph
2011-05-10 20:22 ` Brian Chrisman
@ 2011-05-10 20:28 ` Gregory Farnum
2011-05-10 20:34 ` Yehuda Sadeh Weinraub
0 siblings, 1 reply; 10+ messages in thread
From: Gregory Farnum @ 2011-05-10 20:28 UTC (permalink / raw)
To: Brian Chrisman; +Cc: ceph-devel
On Tue, May 10, 2011 at 1:22 PM, Brian Chrisman <brchrisman@gmail.com> wrote:
> They differentiate between xattrs on symlinks or on the files at which
> they point.
> If I recall, it's a slight difference internally to the Client class
> whether a value is passed to path_walk as true/false, though I may be
> misinterpreting that. I can look at that again.
>
> On Tue, May 10, 2011 at 12:44 PM, Gregory Farnum <gregf@hq.newdream.net> wrote:
>> What are the 'l'-prefixed functions for? They look like they're just
>> duplicates except for the prefix.
>> -Greg
Ah, right. I didn't notice the different flag values in the call to
path_walk. :) I think you're right about what it means, though!
Maybe we could give them more descriptive names or something?
-Greg
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] support for xattrs in libceph
2011-05-10 19:38 ` [PATCH 1/2] support for xattrs in libceph Brian Chrisman
2011-05-10 19:44 ` Gregory Farnum
@ 2011-05-10 20:30 ` Yehuda Sadeh Weinraub
1 sibling, 0 replies; 10+ messages in thread
From: Yehuda Sadeh Weinraub @ 2011-05-10 20:30 UTC (permalink / raw)
To: Brian Chrisman; +Cc: ceph-devel, Brian Chrisman
On Tue, May 10, 2011 at 12:38 PM, Brian Chrisman <brchrisman@gmail.com> wrote:
> @@ -5708,7 +5773,7 @@ int Client::ll_removexattr(vinodeno_t vino, const char *name, int uid, int gid)
> tout << name << std::endl;
>
> // only user xattrs, for now
> - if (strncmp(name, "user.", 5))
> + if (strncmp(name, "user.", 5) && strncmp(name, "security.", 9) && strncmp(name, "trusted.", 8))
> return -EOPNOTSUPP;
>
> Inode *in = _ll_get_inode(vino);
Good catch. That should be applied separately, and maybe go to the
stable branch too.
Thanks,
Yehuda
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] support for xattrs in libceph
2011-05-10 20:28 ` Gregory Farnum
@ 2011-05-10 20:34 ` Yehuda Sadeh Weinraub
2011-05-10 20:35 ` Gregory Farnum
0 siblings, 1 reply; 10+ messages in thread
From: Yehuda Sadeh Weinraub @ 2011-05-10 20:34 UTC (permalink / raw)
To: Gregory Farnum; +Cc: Brian Chrisman, ceph-devel
On Tue, May 10, 2011 at 1:28 PM, Gregory Farnum <gregf@hq.newdream.net> wrote:
> On Tue, May 10, 2011 at 1:22 PM, Brian Chrisman <brchrisman@gmail.com> wrote:
>> They differentiate between xattrs on symlinks or on the files at which
>> they point.
>> If I recall, it's a slight difference internally to the Client class
>> whether a value is passed to path_walk as true/false, though I may be
>> misinterpreting that. I can look at that again.
>>
>> On Tue, May 10, 2011 at 12:44 PM, Gregory Farnum <gregf@hq.newdream.net> wrote:
>>> What are the 'l'-prefixed functions for? They look like they're just
>>> duplicates except for the prefix.
>>> -Greg
>
> Ah, right. I didn't notice the different flag values in the call to
> path_walk. :) I think you're right about what it means, though!
> Maybe we could give them more descriptive names or something?
lsetxattr and friends are known linux API functions, and have
corresponding system calls with the same name. I say let's keep them
as is.
Yehuda
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/2] support for xattrs in libceph
2011-05-10 20:34 ` Yehuda Sadeh Weinraub
@ 2011-05-10 20:35 ` Gregory Farnum
0 siblings, 0 replies; 10+ messages in thread
From: Gregory Farnum @ 2011-05-10 20:35 UTC (permalink / raw)
To: Yehuda Sadeh Weinraub; +Cc: Brian Chrisman, ceph-devel
On Tue, May 10, 2011 at 1:34 PM, Yehuda Sadeh Weinraub
<yehudasa@gmail.com> wrote:
> lsetxattr and friends are known linux API functions, and have
> corresponding system calls with the same name. I say let's keep them
> as is.
Heh. Should probably just ignore clueless me in that case. :)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/2] adding libceph xattr support
2011-05-10 19:38 [PATCH 0/2] adding libceph xattr support Brian Chrisman
2011-05-10 19:38 ` [PATCH 1/2] support for xattrs in libceph Brian Chrisman
2011-05-10 19:38 ` [PATCH 2/2] expand testceph to check xattrs Brian Chrisman
@ 2011-05-11 17:29 ` Sage Weil
2 siblings, 0 replies; 10+ messages in thread
From: Sage Weil @ 2011-05-11 17:29 UTC (permalink / raw)
To: Brian Chrisman; +Cc: ceph-devel
Thanks Brian, applied these. (Also broke out the namespace thing into a
separate patch.)
sage
On Tue, 10 May 2011, Brian Chrisman wrote:
> Expands libceph to handle xattr calls including underlying Client methods.
> testceph is expanded to verify libceph xattr calls work.
>
> Brian Chrisman (2):
> support for xattrs in libceph
> expand testceph to check xattrs
>
> src/client/Client.cc | 67 +++++++++++++++++++++++++++++++++++++++-
> src/client/Client.h | 10 ++++++
> src/client/testceph.cc | 74 +++++++++++++++++++++++++++++++++++++++++++-
> src/include/ceph/libceph.h | 15 +++++++++
> src/libceph.cc | 42 +++++++++++++++++++++++++
> 5 files changed, 206 insertions(+), 2 deletions(-)
>
> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-05-11 17:28 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-10 19:38 [PATCH 0/2] adding libceph xattr support Brian Chrisman
2011-05-10 19:38 ` [PATCH 1/2] support for xattrs in libceph Brian Chrisman
2011-05-10 19:44 ` Gregory Farnum
2011-05-10 20:22 ` Brian Chrisman
2011-05-10 20:28 ` Gregory Farnum
2011-05-10 20:34 ` Yehuda Sadeh Weinraub
2011-05-10 20:35 ` Gregory Farnum
2011-05-10 20:30 ` Yehuda Sadeh Weinraub
2011-05-10 19:38 ` [PATCH 2/2] expand testceph to check xattrs Brian Chrisman
2011-05-11 17:29 ` [PATCH 0/2] adding libceph xattr support Sage Weil
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.