int rgw_create(struct rgw_fs *rgw_fs,
struct rgw_file_handle *parent_fh,
const char *name, mode_t mode, struct stat *st,
- struct rgw_file_handle *fh);
+ struct rgw_file_handle **fh);
/*
create a new directory
int rgw_mkdir(struct rgw_fs *rgw_fs,
struct rgw_file_handle *parent_fh,
const char *name, mode_t mode, struct stat *st,
- struct rgw_file_handle *fh);
+ struct rgw_file_handle **fh);
/*
rename object
int rgw_create(struct rgw_fs *rgw_fs,
struct rgw_file_handle *parent_fh,
const char *name, mode_t mode, struct stat *st,
- struct rgw_file_handle *handle)
+ struct rgw_file_handle **fh)
{
- return 0;
+ return EINVAL;
}
/*
int rgw_mkdir(struct rgw_fs *rgw_fs,
struct rgw_file_handle *parent_fh,
const char *name, mode_t mode, struct stat *st,
- struct rgw_file_handle *handle)
+ struct rgw_file_handle **fh)
{
int rc;
RGWCreateBucketRequest req(cct, fs->get_user(), uri);
rc = librgw.get_fe()->execute_req(&req);
+ /* XXX: atomicity */
+ RGWFileHandle* rgw_fh = fs->lookup_fh(parent, name);
+
+ struct rgw_file_handle *rfh = rgw_fh->get_fh();
+ *fh = rfh;
+
return rc;
}
TEST(LibRGW, CREATE_BUCKET) {
if (do_create) {
struct stat st;
- struct rgw_file_handle fh;
+ struct rgw_file_handle *fh;
int ret = rgw_mkdir(fs, fs->root_fh, bucket_name.c_str(), 755, &st, &fh);
ASSERT_EQ(ret, 0);
}
if (do_multi) {
int ret;
struct stat st;
- struct rgw_file_handle fh;
+ struct rgw_file_handle *fh;
for (int ix = 0; ix < multi_cnt; ++ix) {
string bn = bucket_name;
bn += to_string(ix);