extern "C" int ceph_ll_rename(class ceph_mount_info *cmount,
Inode *parent, const char *name,
Inode *newparent, const char *newname,
- int uid, int gid)
+ const UserPerm *perms)
{
- UserPerm perms(uid, gid);
- return (cmount->get_client()->ll_rename(parent, name,
- newparent, newname, perms));
+ return cmount->get_client()->ll_rename(parent, name, newparent,
+ newname, *perms);
}
-extern "C" int ceph_ll_unlink(class ceph_mount_info *cmount,
- Inode *in, const char *name,
- int uid, int gid)
+extern "C" int ceph_ll_unlink(class ceph_mount_info *cmount, Inode *in,
+ const char *name, const UserPerm *perms)
{
- UserPerm perms(uid, gid);
- return (cmount->get_client()->ll_unlink(in, name, perms));
+ return cmount->get_client()->ll_unlink(in, name, *perms);
}
extern "C" int ceph_ll_statfs(class ceph_mount_info *cmount,
struct ceph_statx stx;
int rc;
struct flock lock1, lock2;
+ UserPerm *perms = ceph_mount_perms(cmount);
// Get the root inode
rc = ceph_ll_lookup_root(cmount, &root);
// Get the inode and Fh corresponding to c_file
rc = ceph_ll_create(cmount, root, c_file, fileMode, O_RDWR | O_CREAT,
- &inode, &fh, &stx, 0, 0, ceph_mount_perms(cmount));
+ &inode, &fh, &stx, 0, 0, perms);
ASSERT_EQ(rc, 0);
// write lock twice
ASSERT_EQ(lock2.l_pid, getpid());
ASSERT_EQ(0, ceph_ll_close(cmount, fh));
- ASSERT_EQ(0, ceph_ll_unlink(cmount, root, c_file, 0, 0));
+ ASSERT_EQ(0, ceph_ll_unlink(cmount, root, c_file, perms));
CLEANUP_CEPH();
}
struct ceph_statx stx;
struct flock lock1;
int rc;
+ UserPerm *perms = ceph_mount_perms(cmount);
// Get the root inode
rc = ceph_ll_lookup_root(cmount, &root);
// Get the inode and Fh corresponding to c_file
rc = ceph_ll_create(cmount, root, c_file, fileMode, O_RDWR | O_CREAT,
- &inode, &fh, &stx, 0, 0, ceph_mount_perms(cmount));
+ &inode, &fh, &stx, 0, 0, perms);
ASSERT_EQ(rc, 0);
// Lock
ASSERT_EQ(NULL, retval);
s.sem_destroy();
ASSERT_EQ(0, ceph_ll_close(cmount, fh));
- ASSERT_EQ(0, ceph_ll_unlink(cmount, root, c_file, 0, 0));
+ ASSERT_EQ(0, ceph_ll_unlink(cmount, root, c_file, perms));
CLEANUP_CEPH();
}
struct ceph_statx stx;
struct flock lock1;
int rc;
+ UserPerm *perms = ceph_mount_perms(cmount);
// Get the root inode
rc = ceph_ll_lookup_root(cmount, &root);
// Get the inode and Fh corresponding to c_file
rc = ceph_ll_create(cmount, root, c_file, fileMode, O_RDWR | O_CREAT,
- &inode, &fh, &stx, 0, 0, ceph_mount_perms(cmount));
+ &inode, &fh, &stx, 0, 0, perms);
ASSERT_EQ(rc, 0);
// Lock
ASSERT_EQ(NULL, retval);
s.sem_destroy();
ASSERT_EQ(0, ceph_ll_close(cmount, fh));
- ASSERT_EQ(0, ceph_ll_unlink(cmount, root, c_file, 0, 0));
+ ASSERT_EQ(0, ceph_ll_unlink(cmount, root, c_file, perms));
CLEANUP_CEPH();
}
struct timespec ts;
struct ceph_mount_info *cmount;
STARTUP_CEPH();
+ UserPerm *perms = ceph_mount_perms(cmount);
// Get the root inode
rc = ceph_ll_lookup_root(cmount, &root);
// Get the inode and Fh corresponding to c_file
rc = ceph_ll_create(cmount, root, c_file, fileMode, O_RDWR | O_CREAT,
- &inode, &fh, &stx, 0, 0, ceph_mount_perms(cmount));
+ &inode, &fh, &stx, 0, 0, perms);
ASSERT_EQ(rc, 0);
// Lock
s.sem_destroy();
ASSERT_EQ(0, munmap(shs, sizeof(*shs)));
ASSERT_EQ(0, ceph_ll_close(cmount, fh));
- ASSERT_EQ(0, ceph_ll_unlink(cmount, root, c_file, 0, 0));
+ ASSERT_EQ(0, ceph_ll_unlink(cmount, root, c_file, perms));
CLEANUP_CEPH();
}
ASSERT_EQ(rc, 0);
// Get the inode and Fh corresponding to c_file
+ UserPerm *perms = ceph_mount_perms(cmount);
rc = ceph_ll_create(cmount, root, c_file, fileMode, O_RDWR | O_CREAT,
- &inode, &fh, &stx, 0, 0, ceph_mount_perms(cmount));
+ &inode, &fh, &stx, 0, 0, perms);
ASSERT_EQ(rc, 0);
// Lock
s.sem_destroy();
ASSERT_EQ(0, munmap(shs, sizeof(*shs)));
ASSERT_EQ(0, ceph_ll_close(cmount, fh));
- ASSERT_EQ(0, ceph_ll_unlink(cmount, root, c_file, 0, 0));
+ ASSERT_EQ(0, ceph_ll_unlink(cmount, root, c_file, perms));
CLEANUP_CEPH();
}
ASSERT_EQ(ceph_ll_getattr(cmount, file, &stx, CEPH_STATX_NLINK, 0, perms), 0);
ASSERT_EQ(stx.stx_nlink, (nlink_t)2);
- ASSERT_EQ(ceph_ll_unlink(cmount, dir, linkname, getuid(), getgid()), 0);
+ ASSERT_EQ(ceph_ll_unlink(cmount, dir, linkname, perms), 0);
ASSERT_EQ(ceph_ll_lookup(cmount, dir, filename, &file, &stx,
CEPH_STATX_NLINK, 0, perms), 0);
ASSERT_EQ(stx.stx_nlink, (nlink_t)1);
UserPerm *perms2 = ceph_mount_perms(cmount2);
ASSERT_EQ(ceph_ll_lookup_root(cmount1, &root1), 0);
- ceph_ll_unlink(cmount1, root1, filename, getuid(), getgid());
+ ceph_ll_unlink(cmount1, root1, filename, perms1);
ASSERT_EQ(ceph_ll_create(cmount1, root1, filename, 0666, O_RDWR|O_CREAT|O_EXCL,
&file1, &fh, &stx, 0, 0, perms1), 0);