static int volicon_statfs(const char *path, struct statvfs *stbuf) { if (volicon_is_a_magic_file(path)) { return fuse_fs_statfs(volicon_get()->next, "/", stbuf); } return fuse_fs_statfs(volicon_get()->next, path, stbuf); }
static int volicon_rmdir(const char *path) { ERROR_IF_MAGIC_FILE(path, ENOTDIR); return fuse_fs_rmdir(volicon_get()->next, path); }
static int volicon_unlink(const char *path) { ERROR_IF_MAGIC_FILE(path, EACCES); return fuse_fs_unlink(volicon_get()->next, path); }
static int volicon_mkdir(const char *path, mode_t mode) { ERROR_IF_MAGIC_FILE(path, EEXIST); return fuse_fs_mkdir(volicon_get()->next, path, mode); }
static int volicon_mknod(const char *path, mode_t mode, dev_t rdev) { ERROR_IF_MAGIC_FILE(path, EEXIST); return fuse_fs_mknod(volicon_get()->next, path, mode, rdev); }
static int volicon_readlink(const char *path, char *buf, size_t size) { ERROR_IF_MAGIC_FILE(path, EINVAL); return fuse_fs_readlink(volicon_get()->next, path, buf, size); }
static int volicon_symlink(const char *from, const char *path) { ERROR_IF_MAGIC_FILE(path, EEXIST); return fuse_fs_symlink(volicon_get()->next, from, path); }
static int volicon_chmod(const char *path, mode_t mode) { ERROR_IF_MAGIC_FILE(path, EACCES); return fuse_fs_chmod(volicon_get()->next, path, mode); }
static int volicon_bmap(const char *path, size_t blocksize, uint64_t *idx) { ERROR_IF_MAGIC_FILE(path, ENOTSUP); return fuse_fs_bmap(volicon_get()->next, path, blocksize, idx); }
static int volicon_utimens(const char *path, const struct timespec ts[2]) { ERROR_IF_MAGIC_FILE(path, EACCES); return fuse_fs_utimens(volicon_get()->next, path, ts); }
static int volicon_releasedir(const char *path, struct fuse_file_info *fi) { ERROR_IF_MAGIC_FILE(path, ENOTDIR); return fuse_fs_releasedir(volicon_get()->next, path, fi); }
static int volicon_fsyncdir(const char *path, int isdatasync, struct fuse_file_info *fi) { ERROR_IF_MAGIC_FILE(path, ENOTDIR); return fuse_fs_fsyncdir(volicon_get()->next, path, isdatasync, fi); }
static int volicon_flush(const char *path, struct fuse_file_info *fi) { ERROR_IF_MAGIC_FILE(path, 0); return fuse_fs_flush(volicon_get()->next, path, fi); }
static int volicon_chown(const char *path, uid_t uid, gid_t gid) { ERROR_IF_MAGIC_FILE(path, EACCES); return fuse_fs_chown(volicon_get()->next, path, uid, gid); }
static int volicon_rename(const char *from, const char *to) { ERROR_IF_MAGIC_FILE(from, EACCES); ERROR_IF_MAGIC_FILE(to, EACCES); return fuse_fs_rename(volicon_get()->next, from, to); }
static int volicon_truncate(const char *path, off_t size) { ERROR_IF_MAGIC_FILE(path, EACCES); return fuse_fs_truncate(volicon_get()->next, path, size); }
static int volicon_setcrtime(const char *path, const struct timespec *crtime) { ERROR_IF_MAGIC_FILE(path, EPERM); return fuse_fs_setcrtime(volicon_get()->next, path, crtime); }
static int volicon_chflags(const char *path, uint32_t flags) { ERROR_IF_MAGIC_FILE(path, EACCES); return fuse_fs_chflags(volicon_get()->next, path, flags); }
static int volicon_setattr_x(const char *path, struct setattr_x *attr) { ERROR_IF_MAGIC_FILE(path, EACCES); return fuse_fs_setattr_x(volicon_get()->next, path, attr); }
static int volicon_create(const char *path, mode_t mode, struct fuse_file_info *fi) { ERROR_IF_MAGIC_FILE(path, EEXIST); return fuse_fs_create(volicon_get()->next, path, mode, fi); }
static int volicon_ftruncate(const char *path, off_t size, struct fuse_file_info *fi) { ERROR_IF_MAGIC_FILE(path, EACCES); return fuse_fs_ftruncate(volicon_get()->next, path, size, fi); }
static int volicon_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi) { ERROR_IF_MAGIC_FILE(path, ENOTDIR); return fuse_fs_readdir(volicon_get()->next, path, buf, filler, offset, fi); }
static int volicon_lock(const char *path, struct fuse_file_info *fi, int cmd, struct flock *lock) { ERROR_IF_MAGIC_FILE(path, ENOTSUP); return fuse_fs_lock(volicon_get()->next, path, fi, cmd, lock); }
static int volicon_write_buf(const char *path, struct fuse_bufvec *buf, off_t offset, struct fuse_file_info *fi) { ERROR_IF_MAGIC_FILE(path, EACCES); return fuse_fs_write_buf(volicon_get()->next, path, buf, offset, fi); }
static int volicon_fsetattr_x(const char *path, struct setattr_x *attr, struct fuse_file_info *fi) { ERROR_IF_MAGIC_FILE(path, EACCES); return fuse_fs_fsetattr_x(volicon_get()->next, path, attr, fi); }
static int volicon_write(const char *path, const char *buf, size_t size, off_t off, struct fuse_file_info *fi) { ERROR_IF_MAGIC_FILE(path, EACCES); return fuse_fs_write(volicon_get()->next, path, buf, size, off, fi); }
static int volicon_fallocate(const char *path, int mode, off_t offset, off_t length, struct fuse_file_info *fi) { ERROR_IF_MAGIC_FILE(path, ENOTSUP); return fuse_fs_fallocate(volicon_get()->next, path, mode, offset, length, fi); }
static int volicon_exchange(const char *path1, const char *path2, unsigned long options) { ERROR_IF_MAGIC_FILE(path1, EACCES); ERROR_IF_MAGIC_FILE(path2, EACCES); return fuse_fs_exchange(volicon_get()->next, path1, path2, options); }
static void * volicon_init(struct fuse_conn_info *conn) { struct volicon *d = volicon_get(); fuse_fs_init(d->next, conn); return d; }
static int volicon_read_buf(const char *path, struct fuse_bufvec **bufp, size_t size, off_t offset, struct fuse_file_info *fi) { int res = 0; if (volicon_is_icon_magic_file(path)) { struct fuse_bufvec *buf; void *mem; size_t a_size; buf = malloc(sizeof(struct fuse_bufvec)); if (buf == NULL) { return -ENOMEM; } if ((offset + size) <= volicon_get()->volicon_size) { a_size = size; } else if (offset < volicon_get()->volicon_size) { a_size = volicon_get()->volicon_size - offset; } else { a_size = 0; } mem = malloc(a_size); if (mem == NULL) { free(buf); return -ENOMEM; } memcpy(mem, (char *)(volicon_get()->volicon_data) + offset, a_size); *buf = FUSE_BUFVEC_INIT(size); buf->buf[0].mem = mem; buf->buf[0].size = a_size; *bufp = buf; } else { res = fuse_fs_read_buf(volicon_get()->next, path, bufp, size, offset, fi); } return res; }