Also remove the lstatlite() declaration, since it's not defined.
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
return _setattr(f->inode, attr, mask, perms);
}
-int Client::stat(const char *relpath, struct stat *stbuf,
- frag_info_t *dirstat, int mask)
+int Client::stat(const char *relpath, struct stat *stbuf, const UserPerm& perms,
+ frag_info_t *dirstat, int mask)
{
ldout(cct, 3) << "stat enter (relpath " << relpath << " mask " << mask << ")" << dendl;
Mutex::Locker lock(client_lock);
tout(cct) << relpath << std::endl;
filepath path(relpath);
InodeRef in;
- int r = path_walk(path, &in);
+ int r = path_walk(path, &in, perms);
if (r < 0)
return r;
- r = _getattr(in, mask);
+ r = _getattr(in, mask, perms);
if (r < 0) {
ldout(cct, 3) << "stat exit on error!" << dendl;
return r;
}
int Client::lstat(const char *relpath, struct stat *stbuf,
- frag_info_t *dirstat, int mask)
+ const UserPerm& perms, frag_info_t *dirstat, int mask)
{
ldout(cct, 3) << "lstat enter (relpath " << relpath << " mask " << mask << ")" << dendl;
Mutex::Locker lock(client_lock);
filepath path(relpath);
InodeRef in;
// don't follow symlinks
- int r = path_walk(path, &in, false);
+ int r = path_walk(path, &in, perms, false);
if (r < 0)
return r;
- r = _getattr(in, mask);
+ r = _getattr(in, mask, perms);
if (r < 0) {
ldout(cct, 3) << "lstat exit on error!" << dendl;
return r;
return _fsync(f->inode.get(), syncdataonly);
}
-int Client::fstat(int fd, struct stat *stbuf, int mask)
+int Client::fstat(int fd, struct stat *stbuf, const UserPerm& perms, int mask)
{
Mutex::Locker lock(client_lock);
tout(cct) << "fstat mask " << hex << mask << dec << std::endl;
Fh *f = get_filehandle(fd);
if (!f)
return -EBADF;
- int r = _getattr(f->inode, mask);
+ int r = _getattr(f->inode, mask, perms);
if (r < 0)
return r;
fill_stat(f->inode, stbuf, NULL);
int symlink(const char *existing, const char *newname);
// inode stuff
- int stat(const char *path, struct stat *stbuf, frag_info_t *dirstat=0, int mask=CEPH_STAT_CAP_INODE_ALL);
- int lstat(const char *path, struct stat *stbuf, frag_info_t *dirstat=0, int mask=CEPH_STAT_CAP_INODE_ALL);
- int lstatlite(const char *path, struct statlite *buf);
+ int stat(const char *path, struct stat *stbuf, const UserPerm& perms,
+ frag_info_t *dirstat=0, int mask=CEPH_STAT_CAP_INODE_ALL);
+ int lstat(const char *path, struct stat *stbuf, const UserPerm& perms,
+ frag_info_t *dirstat=0, int mask=CEPH_STAT_CAP_INODE_ALL);
int setattr(const char *relpath, struct stat *attr, int mask, const UserPerm& perms);
int fsetattr(int fd, struct stat *attr, int mask, const UserPerm& perms);
int fake_write_size(int fd, loff_t size);
int ftruncate(int fd, loff_t size, const UserPerm& perms);
int fsync(int fd, bool syncdataonly);
- int fstat(int fd, struct stat *stbuf, int mask=CEPH_STAT_CAP_INODE_ALL);
+ int fstat(int fd, struct stat *stbuf, const UserPerm& perms,
+ int mask=CEPH_STAT_CAP_INODE_ALL);
int fallocate(int fd, int mode, loff_t offset, loff_t length);
// full path xattr ops
client->mknod("test", 0777);
struct stat st;
for (int i=0; i<count; i++) {
- client->lstat("test", &st);
+ client->lstat("test", &st, perms);
client->chmod("test", 0777, perms);
}
}
strcmp(a, "/") != 0 &&
strcmp(a, "/lib") != 0 && // or /lib.. that would be a lookup. hack.
a[0] != 0) // stop stating the root directory already
- client->lstat(a, &st);
+ client->lstat(a, &st, perms);
} else if (strcmp(op, "chmod") == 0) {
const char *a = t.get_string(buf, p);
int64_t b = t.get_int();
if (time_to_stop()) break;
struct stat st;
- int r = client->lstat(file.c_str(), &st);
+ int r = client->lstat(file.c_str(), &st, perms);
if (r < 0) {
dout(1) << "stat error on " << file << " r=" << r << dendl;
continue;
struct stat st;
frag_info_t dirstat;
- int r = client->lstat(file.c_str(), &st, &dirstat);
+ int r = client->lstat(file.c_str(), &st, perms, &dirstat);
if (r < 0) {
dout(1) << "stat error on " << file << " r=" << r << dendl;
continue;
int SyntheticClient::dump_placement(string& fn) {
+
+ UserPerm perms = client->pick_my_perms();
// open file
int fd = client->open(fn.c_str(), O_RDONLY);
// How big is it?
struct stat stbuf;
- int lstat_result = client->lstat(fn.c_str(), &stbuf);
+ int lstat_result = client->lstat(fn.c_str(), &stbuf, perms);
if (lstat_result < 0) {
dout(0) << "lstat error for file " << fn << dendl;
client->close(fd);
{
if (time_to_stop()) return 0;
+ UserPerm perms = client->pick_my_perms();
+
// make sure base dir exists
struct stat st;
- int r = client->lstat(basedir, &st);
+ int r = client->lstat(basedir, &st, perms);
if (r != 0) {
dout(1) << "can't make base dir? " << basedir << dendl;
return -1;
dout(3) << "stat_dirs " << basedir << " dirs " << dirs << " files " << files << " depth " << depth << dendl;
for (int i=0; i<files; i++) {
snprintf(d, sizeof(d), "%s/file.%d", basedir, i);
- client->lstat(d, &st);
+ client->lstat(d, &st, perms);
}
if (depth == 0) return 0;
for (int i=0; i<files; i++) {
snprintf(d, sizeof(d), "%s/file.%d", basedir, i);
utime_t s = ceph_clock_now(client->cct);
- if (client->lstat(d, &st) < 0) {
+ if (client->lstat(d, &st, perms) < 0) {
dout(2) << "read_dirs failed stat on " << d << ", stopping" << dendl;
return -1;
}
client->mknod(d, 0644);
if (more) {
- client->lstat(d, &st);
+ client->lstat(d, &st, perms);
int fd = client->open(d, O_RDONLY);
client->unlink(d, perms);
client->close(fd);
} else
op = CEPH_MDS_OP_READDIR;
} else
- r = client->lstat(get_random_sub(), &st);
+ r = client->lstat(get_random_sub(), &st, perms);
}
if (op == CEPH_MDS_OP_READDIR) {
return fd;
struct stat st;
- int ret = client->fstat(fd, &st);
+ UserPerm perms = client->pick_my_perms();
+ int ret = client->fstat(fd, &st, perms);
if (ret < 0) {
client->close(fd);
return ret;
{
if (!cmount->is_mounted())
return -ENOTCONN;
- return cmount->get_client()->stat(path, stbuf);
+ UserPerm perms = cmount->get_client()->pick_my_perms();
+ return cmount->get_client()->stat(path, stbuf, perms);
}
extern "C" int ceph_lstat(struct ceph_mount_info *cmount, const char *path,
{
if (!cmount->is_mounted())
return -ENOTCONN;
- return cmount->get_client()->lstat(path, stbuf);
+ UserPerm perms = cmount->get_client()->pick_my_perms();
+ return cmount->get_client()->lstat(path, stbuf, perms);
}
extern "C" int ceph_setattr(struct ceph_mount_info *cmount, const char *relpath,
{
if (!cmount->is_mounted())
return -ENOTCONN;
- return cmount->get_client()->fstat(fd, stbuf);
+ UserPerm perms = cmount->get_client()->pick_my_perms();
+ return cmount->get_client()->fstat(fd, stbuf, perms);
}
extern "C" int ceph_sync_fs(struct ceph_mount_info *cmount)