diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2006-09-30 16:02:25 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2006-09-30 16:02:25 +0000 |
commit | 708b4818f2d0b9a1e277de85a00a0355745a5cd0 (patch) | |
tree | 0e35c2d3906473f9b471eb4029a32e91e32d2480 /lib/fuse.c | |
parent | ff5fa7f8de978d56e8c334e746e08195ed25730d (diff) | |
download | libfuse-708b4818f2d0b9a1e277de85a00a0355745a5cd0.tar.gz |
bmap support
Diffstat (limited to 'lib/fuse.c')
-rw-r--r-- | lib/fuse.c | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -2371,6 +2371,29 @@ static void fuse_setlk(fuse_req_t req, fuse_ino_t ino, reply_err(req, err); } +static void fuse_bmap(fuse_req_t req, fuse_ino_t ino, size_t blocksize, + uint64_t idx) +{ + struct fuse *f = req_fuse_prepare(req); + char *path; + int err; + + err = -ENOENT; + pthread_rwlock_rdlock(&f->tree_lock); + path = get_path(f, ino); + if (path != NULL) { + err = -ENOSYS; + if (f->op.bmap) + err = f->op.bmap(path, blocksize, &idx); + free(path); + } + pthread_rwlock_unlock(&f->tree_lock); + if (!err) + fuse_reply_bmap(req, idx); + else + reply_err(req, err); +} + static struct fuse_lowlevel_ops fuse_path_ops = { .init = fuse_data_init, .destroy = fuse_data_destroy, @@ -2405,6 +2428,7 @@ static struct fuse_lowlevel_ops fuse_path_ops = { .removexattr = fuse_removexattr, .getlk = fuse_getlk, .setlk = fuse_setlk, + .bmap = fuse_bmap, }; static void free_cmd(struct fuse_cmd *cmd) |