*
*/
+#include "common/errno.h"
#include "libceph.h"
+
+#include <errno.h>
#include <iostream>
using std::cout;
}
cout << "Successfully mounted Ceph!" << std::endl;
+ ceph_dir_result_t *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;
+ }
+
+ ret = ceph_mkdir(cmount, "foo", 0777);
+ if (ret) {
+ cerr << "ceph_mkdir error: " << cpp_strerror(ret) << std::endl;
+ return 1;
+ }
+
+ struct stat stbuf;
+ ret = ceph_lstat(cmount, "foo", &stbuf);
+ if (ret) {
+ cerr << "ceph_lstat error: " << cpp_strerror(ret) << std::endl;
+ return 1;
+ }
+
+ if (!S_ISDIR(stbuf.st_mode)) {
+ cerr << "ceph_lstat(foo): foo is not a directory? st_mode = "
+ << stbuf.st_mode << std::endl;
+ return 1;
+ }
+
+ ret = ceph_rmdir(cmount, "foo");
+ if (ret) {
+ cerr << "ceph_rmdir error: " << cpp_strerror(ret) << std::endl;
+ return 1;
+ }
+
+ ret = ceph_mkdirs(cmount, "foo/bar/baz", 0777);
+ if (ret) {
+ cerr << "ceph_mkdirs error: " << cpp_strerror(ret) << std::endl;
+ return 1;
+ }
+ ret = ceph_rmdir(cmount, "foo/bar/baz");
+ if (ret) {
+ cerr << "ceph_rmdir error: " << cpp_strerror(ret) << std::endl;
+ return 1;
+ }
+ ret = ceph_rmdir(cmount, "foo/bar");
+ if (ret) {
+ cerr << "ceph_rmdir error: " << cpp_strerror(ret) << std::endl;
+ return 1;
+ }
+ ret = ceph_rmdir(cmount, "foo");
+ if (ret) {
+ cerr << "ceph_rmdir error: " << cpp_strerror(ret) << std::endl;
+ return 1;
+ }
+
ceph_shutdown(cmount);
return 0;