From: Miklos Szeredi Date: Mon, 28 Oct 2002 08:49:39 +0000 (+0000) Subject: Portability fix X-Git-Tag: debian_version_1_0-1~21 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=6bf8b68e0ee6596e8b5f0e53656a078bc5e579ba;p=qemu-gpiodev%2Flibfuse.git Portability fix --- diff --git a/ChangeLog b/ChangeLog index e9a14af..62a859a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2002-10-28 Miklos Szeredi + + * Portablility fix (bug reported by C. Chris Erway) + 2002-10-25 Miklos Szeredi * Use Mark Glines' fd passing method for default operation instead diff --git a/include/linux/fuse.h b/include/linux/fuse.h index b6f41db..24905c4 100644 --- a/include/linux/fuse.h +++ b/include/linux/fuse.h @@ -119,7 +119,6 @@ struct fuse_getdir_out { struct fuse_mknod_in { unsigned short mode; unsigned short rdev; - char name[0]; }; struct fuse_mknod_out { @@ -129,17 +128,14 @@ struct fuse_mknod_out { struct fuse_mkdir_in { unsigned short mode; - char name[0]; }; struct fuse_rename_in { unsigned long newdir; - char names[0]; }; struct fuse_link_in { unsigned long newdir; - char name[0]; }; struct fuse_setattr_in { @@ -163,7 +159,6 @@ struct fuse_read_in { struct fuse_write_in { unsigned long long offset; unsigned int size; - char buf[0]; }; struct fuse_statfs_out { diff --git a/lib/fuse.c b/lib/fuse.c index b809374..42ab52a 100644 --- a/lib/fuse.c +++ b/lib/fuse.c @@ -17,6 +17,7 @@ #include #define FUSE_MAX_PATH 4096 +#define PARAM(inarg) (((char *)(inarg)) + sizeof(*inarg)) static inline void inc_avail(struct fuse *f) { @@ -572,7 +573,7 @@ static void do_mknod(struct fuse *f, struct fuse_in_header *in, struct stat buf; res = -ENOENT; - path = get_path_name(f, in->ino, inarg->name); + path = get_path_name(f, in->ino, PARAM(inarg)); if(path != NULL) { res = -ENOSYS; if(f->op.mknod && f->op.getattr) { @@ -584,7 +585,7 @@ static void do_mknod(struct fuse *f, struct fuse_in_header *in, } if(res == 0) { convert_stat(&buf, &outarg.attr); - outarg.ino = find_node(f, in->ino, inarg->name, &outarg.attr, + outarg.ino = find_node(f, in->ino, PARAM(inarg), &outarg.attr, in->unique); } @@ -598,7 +599,7 @@ static void do_mkdir(struct fuse *f, struct fuse_in_header *in, char *path; res = -ENOENT; - path = get_path_name(f, in->ino, inarg->name); + path = get_path_name(f, in->ino, PARAM(inarg)); if(path != NULL) { res = -ENOSYS; if(f->op.mkdir) @@ -655,8 +656,8 @@ static void do_rename(struct fuse *f, struct fuse_in_header *in, int res; fino_t olddir = in->ino; fino_t newdir = inarg->newdir; - char *oldname = inarg->names; - char *newname = inarg->names + strlen(oldname) + 1; + char *oldname = PARAM(inarg); + char *newname = oldname + strlen(oldname) + 1; char *oldpath; char *newpath; @@ -687,7 +688,7 @@ static void do_link(struct fuse *f, struct fuse_in_header *in, res = -ENOENT; oldpath = get_path(f, in->ino); if(oldpath != NULL) { - newpath = get_path_name(f, arg->newdir, arg->name); + newpath = get_path_name(f, arg->newdir, PARAM(arg)); if(newpath != NULL) { res = -ENOSYS; if(f->op.link) @@ -774,7 +775,7 @@ static void do_write(struct fuse *f, struct fuse_in_header *in, res = -ENOSYS; if(f->op.write) - res = f->op.write(path, arg->buf, arg->size, arg->offset); + res = f->op.write(path, PARAM(arg), arg->size, arg->offset); free(path); }