aboutsummaryrefslogtreecommitdiffstats
path: root/lib/modules/iconv.c
diff options
context:
space:
mode:
authorNikolaus Rath <Nikolaus@rath.org>2016-10-15 18:46:27 -0700
committerNikolaus Rath <Nikolaus@rath.org>2016-10-15 18:46:27 -0700
commit73b6ff4b75cf1228ea61262c293fcb2fda5dfeea (patch)
tree059d5dbe8d2549f5bf363c6174c5887d44f1ee42 /lib/modules/iconv.c
parentd49f2e77b4741706ec125cc62ea913ed5d39bd39 (diff)
downloadlibfuse-73b6ff4b75cf1228ea61262c293fcb2fda5dfeea.tar.gz
Pass fuse_file_info to getattr, chown, chmod, truncate, utimens handlers
This obsoletes the ftruncate & fgetattr handlers. Fixes #58.
Diffstat (limited to 'lib/modules/iconv.c')
-rw-r--r--lib/modules/iconv.c51
1 files changed, 14 insertions, 37 deletions
diff --git a/lib/modules/iconv.c b/lib/modules/iconv.c
index 174e2b9..41a072c 100644
--- a/lib/modules/iconv.c
+++ b/lib/modules/iconv.c
@@ -101,26 +101,14 @@ err:
return err;
}
-static int iconv_getattr(const char *path, struct stat *stbuf)
+static int iconv_getattr(const char *path, struct stat *stbuf,
+ struct fuse_file_info *fi)
{
struct iconv *ic = iconv_get();
char *newpath;
int err = iconv_convpath(ic, path, &newpath, 0);
if (!err) {
- err = fuse_fs_getattr(ic->next, newpath, stbuf);
- free(newpath);
- }
- return err;
-}
-
-static int iconv_fgetattr(const char *path, struct stat *stbuf,
- struct fuse_file_info *fi)
-{
- struct iconv *ic = iconv_get();
- char *newpath;
- int err = iconv_convpath(ic, path, &newpath, 0);
- if (!err) {
- err = fuse_fs_fgetattr(ic->next, newpath, stbuf, fi);
+ err = fuse_fs_getattr(ic->next, newpath, stbuf, fi);
free(newpath);
}
return err;
@@ -315,62 +303,53 @@ static int iconv_link(const char *from, const char *to)
return err;
}
-static int iconv_chmod(const char *path, mode_t mode)
-{
- struct iconv *ic = iconv_get();
- char *newpath;
- int err = iconv_convpath(ic, path, &newpath, 0);
- if (!err) {
- err = fuse_fs_chmod(ic->next, newpath, mode);
- free(newpath);
- }
- return err;
-}
-
-static int iconv_chown(const char *path, uid_t uid, gid_t gid)
+static int iconv_chmod(const char *path, mode_t mode,
+ struct fuse_file_info *fi)
{
struct iconv *ic = iconv_get();
char *newpath;
int err = iconv_convpath(ic, path, &newpath, 0);
if (!err) {
- err = fuse_fs_chown(ic->next, newpath, uid, gid);
+ err = fuse_fs_chmod(ic->next, newpath, mode, fi);
free(newpath);
}
return err;
}
-static int iconv_truncate(const char *path, off_t size)
+static int iconv_chown(const char *path, uid_t uid, gid_t gid,
+ struct fuse_file_info *fi)
{
struct iconv *ic = iconv_get();
char *newpath;
int err = iconv_convpath(ic, path, &newpath, 0);
if (!err) {
- err = fuse_fs_truncate(ic->next, newpath, size);
+ err = fuse_fs_chown(ic->next, newpath, uid, gid, fi);
free(newpath);
}
return err;
}
-static int iconv_ftruncate(const char *path, off_t size,
+static int iconv_truncate(const char *path, off_t size,
struct fuse_file_info *fi)
{
struct iconv *ic = iconv_get();
char *newpath;
int err = iconv_convpath(ic, path, &newpath, 0);
if (!err) {
- err = fuse_fs_ftruncate(ic->next, newpath, size, fi);
+ err = fuse_fs_truncate(ic->next, newpath, size, fi);
free(newpath);
}
return err;
}
-static int iconv_utimens(const char *path, const struct timespec ts[2])
+static int iconv_utimens(const char *path, const struct timespec ts[2],
+ struct fuse_file_info *fi)
{
struct iconv *ic = iconv_get();
char *newpath;
int err = iconv_convpath(ic, path, &newpath, 0);
if (!err) {
- err = fuse_fs_utimens(ic->next, newpath, ts);
+ err = fuse_fs_utimens(ic->next, newpath, ts, fi);
free(newpath);
}
return err;
@@ -600,7 +579,6 @@ static const struct fuse_operations iconv_oper = {
.destroy = iconv_destroy,
.init = iconv_init,
.getattr = iconv_getattr,
- .fgetattr = iconv_fgetattr,
.access = iconv_access,
.readlink = iconv_readlink,
.opendir = iconv_opendir,
@@ -616,7 +594,6 @@ static const struct fuse_operations iconv_oper = {
.chmod = iconv_chmod,
.chown = iconv_chown,
.truncate = iconv_truncate,
- .ftruncate = iconv_ftruncate,
.utimens = iconv_utimens,
.create = iconv_create,
.open = iconv_open_file,