fix
authorMiklos Szeredi <miklos@szeredi.hu>
Thu, 31 Mar 2005 15:58:35 +0000 (15:58 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Thu, 31 Mar 2005 15:58:35 +0000 (15:58 +0000)
ChangeLog
kernel/dev.c
kernel/dir.c
kernel/file.c
kernel/fuse_kernel.h
lib/fuse.c

index 96c2bb1d0fbcfc286ba08db09df25c66a84037cd..489cbf894ecef02c563a0dd9426357b61c779268 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2005-03-31  Miklos Szeredi <miklos@szeredi.hu>
+
+       * kernel API: add padding to structures, so 64bit and 32bit
+       compiler will return the same size
+
+       * kernel API: add offset field to fuse_dirent.  This will allow
+       more sophisticated readdir interface for userspace
+
+       * kernel API: change major number to 6
+
+       * kernel: fix warnings on 64bit archs
+
 2005-03-24  Miklos Szeredi <miklos@szeredi.hu>
 
        * kernel: trivial cleanups
index b17296a49355130a3ecf2f8257d6817304195c1d..0c80aa071891acac13b657f84fa35ad41186d32b 100644 (file)
@@ -665,6 +665,17 @@ static void request_wait(struct fuse_conn *fc)
        remove_wait_queue(&fc->waitq, &wait);
 }
 
+#ifndef KERNEL_2_6
+static inline size_t iov_length(const struct iovec *iov, unsigned long nr_segs)
+{
+       unsigned long seg;
+       size_t ret = 0;
+
+       for (seg = 0; seg < nr_segs; seg++)
+               ret += iov[seg].iov_len;
+       return ret;
+}
+#endif
 /*
  * Read a single request into the userspace filesystem's buffer.  This
  * function waits until a request is available, then removes it from
index be513093a013591537fdfe34b689940ddd5b4d15..2e020238d1cc96d6b3d88c3d2fd198b25fedb1e0 100644 (file)
@@ -512,7 +512,7 @@ static int parse_dirfile(char *buf, size_t nbytes, struct file *file,
                        break;
 
                over = filldir(dstbuf, dirent->name, dirent->namelen,
-                              file->f_pos, dirent->ino, dirent->type);
+                              dirent->off, dirent->ino, dirent->type);
                if (over)
                        break;
 
index 74921d63864ff2a59eed2ba2bc42f4219b556f09..88bf5f43cd09d69f2c4f7eaeba6df49ec4941109 100644 (file)
@@ -519,7 +519,7 @@ static ssize_t fuse_direct_io(struct file *file, const char __user *buf,
 {
        struct inode *inode = file->f_dentry->d_inode;
        struct fuse_conn *fc = get_fuse_conn(inode);
-       unsigned nmax = write ? fc->max_write : fc->max_read;
+       size_t nmax = write ? fc->max_write : fc->max_read;
        loff_t pos = *ppos;
        ssize_t res = 0;
        struct fuse_req *req = fuse_get_request(fc);
@@ -527,8 +527,8 @@ static ssize_t fuse_direct_io(struct file *file, const char __user *buf,
                return -ERESTARTSYS;
 
        while (count) {
-               unsigned tmp;
-               unsigned nres;
+               size_t tmp;
+               size_t nres;
                size_t nbytes = min(count, nmax);
                int err = fuse_get_user_pages(req, buf, nbytes, !write);
                if (err) {
index 870ce5974f42218d79a6748698ab7a952cdf924b..6dcf9c6b04389a5ed38f89186442f6750f4550b5 100644 (file)
@@ -11,7 +11,7 @@
 #include <asm/types.h>
 
 /** Version number of this interface */
-#define FUSE_KERNEL_VERSION 5
+#define FUSE_KERNEL_VERSION 6
 
 /** Minor version number of this interface */
 #define FUSE_KERNEL_MINOR_VERSION 1
@@ -25,6 +25,9 @@
 /** The minor number of the fuse character device */
 #define FUSE_MINOR 229
 
+/* Make sure all structures are padded to 64bit boundary, so 32bit
+   userspace works under 64bit kernels */
+
 struct fuse_attr {
        __u64   ino;
        __u64   size;
@@ -126,6 +129,7 @@ struct fuse_mknod_in {
 
 struct fuse_mkdir_in {
        __u32   mode;
+       __u32   padding;
 };
 
 struct fuse_rename_in {
@@ -138,32 +142,38 @@ struct fuse_link_in {
 
 struct fuse_setattr_in {
        __u32   valid;
+       __u32   padding;
        struct fuse_attr attr;
 };
 
 struct fuse_open_in {
        __u32   flags;
+       __u32   padding;
 };
 
 struct fuse_open_out {
        __u64   fh;
        __u32   open_flags;
+       __u32   padding;
 };
 
 struct fuse_release_in {
        __u64   fh;
        __u32   flags;
+       __u32   padding;
 };
 
 struct fuse_flush_in {
        __u64   fh;
        __u32   flush_flags;
+       __u32   padding;
 };
 
 struct fuse_read_in {
        __u64   fh;
        __u64   offset;
        __u32   size;
+       __u32   padding;
 };
 
 struct fuse_write_in {
@@ -175,6 +185,7 @@ struct fuse_write_in {
 
 struct fuse_write_out {
        __u32   size;
+       __u32   padding;
 };
 
 struct fuse_statfs_out {
@@ -184,6 +195,7 @@ struct fuse_statfs_out {
 struct fuse_fsync_in {
        __u64   fh;
        __u32   fsync_flags;
+       __u32   padding;
 };
 
 struct fuse_setxattr_in {
@@ -193,10 +205,12 @@ struct fuse_setxattr_in {
 
 struct fuse_getxattr_in {
        __u32   size;
+       __u32   padding;
 };
 
 struct fuse_getxattr_out {
        __u32   size;
+       __u32   padding;
 };
 
 struct fuse_init_in_out {
@@ -212,6 +226,7 @@ struct fuse_in_header {
        __u32   uid;
        __u32   gid;
        __u32   pid;
+       __u32   padding;
 };
 
 struct fuse_out_header {
@@ -222,6 +237,7 @@ struct fuse_out_header {
 
 struct fuse_dirent {
        __u64   ino;
+       __u64   off;
        __u32   namelen;
        __u32   type;
        char name[0];
index a7ba0ee50073c9d7d68f463f803938d44702788e..b6dda76dca2c14daaecadff3d244cc4ac85ae80f 100644 (file)
@@ -464,6 +464,7 @@ static int fill_dir(struct fuse_dirhandle *dh, const char *name, int type,
     dirent->namelen = namelen;
     strncpy(dirent->name, name, namelen);
     dirent->type = type;
+    dirent->off = ftell(dh->fp);
     reclen = FUSE_DIRENT_SIZE(dirent);
     res = fwrite(dirent, reclen, 1, dh->fp);
     free(dirent);