]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librgw: define an rgw_setattr
authorMatt Benjamin <mbenjamin@redhat.com>
Fri, 4 Sep 2015 00:01:24 +0000 (20:01 -0400)
committerMatt Benjamin <mbenjamin@redhat.com>
Fri, 12 Feb 2016 16:57:47 +0000 (11:57 -0500)
Currently, this operation has no effect.  It may be unsafe to
assume that NFS clients can tolerate errors or inconsistency after
SETATTR protocol ops.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/include/rados/rgw_file.h
src/rgw/rgw_file.cc

index 936e757ab518d962430c57344a0f545b7e35575b..5afb70582141bcb6cf746a092f85419b987c91a0 100644 (file)
@@ -14,6 +14,7 @@
 #ifndef RGW_FILE_H
 #define RGW_FILE_H
 
+#include <sys/types.h>
 #include <stdint.h>
 
 #ifdef __cplusplus
@@ -69,20 +70,23 @@ int rgw_mount(const char *uid, const char *key, const char *secret,
 int rgw_statfs(const struct rgw_file_handle *parent_handle,
               struct rgw_statvfs *vfs_st);
 
+
 /*
-  create a new dirctory
+  create file
 */
-int rgw_create_directory(const struct rgw_file_handle *parent_handle,
-                        const char *name);
+int rgw_create(const struct rgw_file_handle *parent_handle,
+              const char *name, mode_t mode, struct stat *st,
+              struct rgw_file_handle *handle);
 
 /*
-  create a new file
+  create a new directory
 */
-int rgw_create_file(const struct rgw_file_handle *parent_handle,
-                   const char* name);
+int rgw_mkdir(const struct rgw_file_handle *parent_handle,
+             const char *name, mode_t mode, struct stat *st,
+             struct rgw_file_handle *handle);
 
 /*
-  move/rename a new file
+  rename object
 */
 int rgw_rename(const struct rgw_file_handle *parent_handle,
               const char* old_name, const char* new_name);
@@ -112,6 +116,9 @@ int rgw_get_attributes(const struct rgw_file_handle *handle);
 
 int rgw_getattr(const struct rgw_file_handle *handle, struct stat *st);
 
+int rgw_setattr(const struct rgw_file_handle *handle, struct stat *st,
+               uint32_t mask);
+
 int rgw_open(const struct rgw_file_handle *handle);
 
 int rgw_close(const struct rgw_file_handle *handle);
index 6d839791741a0da31c84da94b106637c86922ef7..a9d48947c70f44eaeff328f296fcb45b080f3ce5 100644 (file)
@@ -90,29 +90,63 @@ int rgw_statfs(const struct rgw_file_handle *parent_handle,
 }
 
 /*
-  create a new dirctory
+  generic create
 */
-int rgw_create_directory(const struct rgw_file_handle* parent_handle,
-                        const char* name)
+int rgw_create(const struct rgw_file_handle *parent_handle,
+              const char *name, mode_t mode, struct stat *st,
+              struct rgw_file_handle *handle)
 {
-  return 0;
+  string uri;
+  int rc;
+
+  rc = librgw.get_uri(parent_handle->handle, uri);
+  if (rc < 0 ) { /* invalid parent */
+    return rc;
+  }
+
+  uri += "\\";
+  uri += name;
+
+  /* TODO: implement */
+
+  return rgw_get_handle(uri.c_str(), handle);
 }
 
 /*
-  create a new file
+  create a new directory
 */
-int rgw_create_file(const struct rgw_file_handle* parent_handle,
-                   const char* name)
+int rgw_mkdir(const struct rgw_file_handle *parent_handle,
+             const char *name, mode_t mode, struct stat *st,
+             struct rgw_file_handle *handle)
 {
+  string uri;
+  int rc;
+
+  rc = librgw.get_uri(parent_handle->handle, uri);
+  if (rc < 0 ) { /* invalid parent */
+    return rc;
+  }
+
+  /* cannot create a bucket in a bucket */
+  if (! is_root(uri)) {
+    return EINVAL;
+  }
+
+  /* TODO: implement */
+
   return 0;
 }
 
+/*
+  rename object
+*/
 int rgw_rename(const struct rgw_file_handle* parent_handle,
               const char* old_name,
               const char* new_name)
 {
   return 0;
 }
+
 /*
   remove file or directory
 */
@@ -169,6 +203,16 @@ int rgw_getattr(const struct rgw_file_handle *handle, struct stat *st)
   return 0;
 }
 
+/*
+  set unix attributes for object
+*/
+int rgw_setattr(const struct rgw_file_handle *handle, struct stat *st,
+               uint32_t mask)
+{
+  /* XXX no-op */
+  return 0;
+}
+
 /*
   read directory content
 */