#ifndef RGW_FILE_H
#define RGW_FILE_H
+#include <sys/types.h>
#include <stdint.h>
#ifdef __cplusplus
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);
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);
}
/*
- 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
*/
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
*/