#include "include/buffer.h"
#include "include/stringify.h"
#include "include/cephfs/libcephfs.h"
+#include "include/fs_types.h"
#include "include/rados/librados.h"
#include <errno.h>
#include <fcntl.h>
#include <vector>
#include "json_spirit/json_spirit.h"
+#include "include/fs_types.h"
+
#ifdef __linux__
#include <limits.h>
#include <sys/xattr.h>
std::cout << "key: " << *key << std::endl;
free(outbuf);
} else {
- return -EINVAL;
+ return -CEPHFS_EINVAL;
}
if (outs_len) {
string s(outs, outs_len);
ASSERT_EQ(ceph_rename(admin, string(good + "/renameme").c_str(),
string(bad + "/asdf").c_str()), 0);
ASSERT_GE(ceph_write(cmount, fd, "foo", 3, 0), 0);
- ASSERT_GE(ceph_fchmod(cmount, fd, 0777), -EACCES);
- ASSERT_GE(ceph_ftruncate(cmount, fd, 0), -EACCES);
- ASSERT_GE(ceph_fsetxattr(cmount, fd, "user.any", "bar", 3, 0), -EACCES);
+ ASSERT_GE(ceph_fchmod(cmount, fd, 0777), -CEPHFS_EACCES);
+ ASSERT_GE(ceph_ftruncate(cmount, fd, 0), -CEPHFS_EACCES);
+ ASSERT_GE(ceph_fsetxattr(cmount, fd, "user.any", "bar", 3, 0), -CEPHFS_EACCES);
ceph_close(cmount, fd);
ceph_shutdown(cmount);
ASSERT_EQ(0, ceph_conf_read_file(cmount, NULL));
ASSERT_EQ(0, ceph_conf_parse_env(cmount, NULL));
ASSERT_EQ(0, ceph_conf_set(cmount, "key", key.c_str()));
- ASSERT_EQ(-EACCES, ceph_mount(cmount, "/"));
+ ASSERT_EQ(-CEPHFS_EACCES, ceph_mount(cmount, "/"));
ASSERT_EQ(0, ceph_init(cmount));
UserPerm *perms = ceph_userperm_new(123, 456, 0, NULL);
ASSERT_EQ(0, ceph_chown(admin, dir.c_str(), 123, 456));
ASSERT_EQ(0, ceph_mkdir(cmount, string(dir + "/u1").c_str(), 0755));
ASSERT_EQ(0, ceph_chown(admin, dir.c_str(), 1, 456));
- ASSERT_EQ(-EACCES, ceph_mkdir(cmount, string(dir + "/no").c_str(), 0755));
+ ASSERT_EQ(-CEPHFS_EACCES, ceph_mkdir(cmount, string(dir + "/no").c_str(), 0755));
// group bits
ASSERT_EQ(0, ceph_chmod(admin, dir.c_str(), 0770));
ASSERT_EQ(0, ceph_chown(admin, dir.c_str(), 1, 456));
ASSERT_EQ(0, ceph_mkdir(cmount, string(dir + "/u2").c_str(), 0755));
ASSERT_EQ(0, ceph_chown(admin, dir.c_str(), 1, 2));
- ASSERT_EQ(-EACCES, ceph_mkdir(cmount, string(dir + "/no").c_str(), 0755));
+ ASSERT_EQ(-CEPHFS_EACCES, ceph_mkdir(cmount, string(dir + "/no").c_str(), 0755));
// user overrides group
ASSERT_EQ(0, ceph_chmod(admin, dir.c_str(), 0470));
ASSERT_EQ(0, ceph_chown(admin, dir.c_str(), 123, 456));
- ASSERT_EQ(-EACCES, ceph_mkdir(cmount, string(dir + "/no").c_str(), 0755));
+ ASSERT_EQ(-CEPHFS_EACCES, ceph_mkdir(cmount, string(dir + "/no").c_str(), 0755));
// other
ASSERT_EQ(0, ceph_chmod(admin, dir.c_str(), 0777));
ASSERT_EQ(0, ceph_chown(admin, dir.c_str(), 1, 1));
ASSERT_EQ(0, ceph_mkdir(cmount, string(dir + "/u3").c_str(), 0755));
ASSERT_EQ(0, ceph_chmod(admin, dir.c_str(), 0770));
- ASSERT_EQ(-EACCES, ceph_mkdir(cmount, string(dir + "/no").c_str(), 0755));
+ ASSERT_EQ(-CEPHFS_EACCES, ceph_mkdir(cmount, string(dir + "/no").c_str(), 0755));
// user and group overrides other
ASSERT_EQ(0, ceph_chmod(admin, dir.c_str(), 07));
ASSERT_EQ(0, ceph_chown(admin, dir.c_str(), 1, 456));
- ASSERT_EQ(-EACCES, ceph_mkdir(cmount, string(dir + "/no").c_str(), 0755));
+ ASSERT_EQ(-CEPHFS_EACCES, ceph_mkdir(cmount, string(dir + "/no").c_str(), 0755));
ASSERT_EQ(0, ceph_chown(admin, dir.c_str(), 123, 1));
- ASSERT_EQ(-EACCES, ceph_mkdir(cmount, string(dir + "/no").c_str(), 0755));
+ ASSERT_EQ(-CEPHFS_EACCES, ceph_mkdir(cmount, string(dir + "/no").c_str(), 0755));
ASSERT_EQ(0, ceph_chown(admin, dir.c_str(), 123, 456));
- ASSERT_EQ(-EACCES, ceph_mkdir(cmount, string(dir + "/no").c_str(), 0755));
+ ASSERT_EQ(-CEPHFS_EACCES, ceph_mkdir(cmount, string(dir + "/no").c_str(), 0755));
// chown and chgrp
ASSERT_EQ(0, ceph_chmod(admin, dir.c_str(), 0700));
ASSERT_EQ(0, ceph_chown(cmount, dir.c_str(), 123, 456));
// ASSERT_EQ(0, ceph_chown(cmount, dir.c_str(), -1, 789));
ASSERT_EQ(0, ceph_chown(cmount, dir.c_str(), -1, 456));
- ASSERT_EQ(-EACCES, ceph_chown(cmount, dir.c_str(), 123, 1));
- ASSERT_EQ(-EACCES, ceph_chown(cmount, dir.c_str(), 1, 456));
+ ASSERT_EQ(-CEPHFS_EACCES, ceph_chown(cmount, dir.c_str(), 123, 1));
+ ASSERT_EQ(-CEPHFS_EACCES, ceph_chown(cmount, dir.c_str(), 1, 456));
ASSERT_EQ(0, ceph_chown(admin, dir.c_str(), 1, 1));
- ASSERT_EQ(-EACCES, ceph_chown(cmount, dir.c_str(), 123, 456));
- ASSERT_EQ(-EACCES, ceph_chown(cmount, dir.c_str(), 123, -1));
- ASSERT_EQ(-EACCES, ceph_chown(cmount, dir.c_str(), -1, 456));
+ ASSERT_EQ(-CEPHFS_EACCES, ceph_chown(cmount, dir.c_str(), 123, 456));
+ ASSERT_EQ(-CEPHFS_EACCES, ceph_chown(cmount, dir.c_str(), 123, -1));
+ ASSERT_EQ(-CEPHFS_EACCES, ceph_chown(cmount, dir.c_str(), -1, 456));
ASSERT_EQ(0, ceph_chown(admin, dir.c_str(), 1, 456));
- ASSERT_EQ(-EACCES, ceph_chown(cmount, dir.c_str(), 123, 456));
- ASSERT_EQ(-EACCES, ceph_chown(cmount, dir.c_str(), 123, -1));
- ASSERT_EQ(-EACCES, ceph_chown(cmount, dir.c_str(), -1, 456));
+ ASSERT_EQ(-CEPHFS_EACCES, ceph_chown(cmount, dir.c_str(), 123, 456));
+ ASSERT_EQ(-CEPHFS_EACCES, ceph_chown(cmount, dir.c_str(), 123, -1));
+ ASSERT_EQ(-CEPHFS_EACCES, ceph_chown(cmount, dir.c_str(), -1, 456));
ASSERT_EQ(0, ceph_chown(admin, dir.c_str(), 123, 1));
ASSERT_EQ(0, ceph_chown(cmount, dir.c_str(), -1, 456));