Revert "Add mmap() and munmap() methods to low level API"
authorMiklos Szeredi <mszeredi@suse.cz>
Tue, 24 Jan 2012 12:01:39 +0000 (13:01 +0100)
committerMiklos Szeredi <mszeredi@suse.cz>
Tue, 24 Jan 2012 13:32:28 +0000 (14:32 +0100)
This partially reverts commit 4b2157c44e6ad7e692fcffb7450143e83151d36b.

Remove mmap/munmap suppor as this missed the interface changes for Linux-3.3
(API version 7.18).

Only revert the mmap/munmap bits and leave the retrieve_reply API fix in place
as well as the optimization in fuse_send_data_iov_fallback().

ChangeLog
include/cuse_lowlevel.h
include/fuse_kernel.h
include/fuse_lowlevel.h
lib/cuse_lowlevel.c
lib/fuse_lowlevel.c
lib/fuse_versionscript

index fdedb6e303ee382a123aa1d303eb0625ef302111..00cd46e5c112009c351b82e168207450232707b7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -32,9 +32,6 @@
 
 2011-12-06  Miklos Szeredi <miklos@szeredi.hu>
 
-       * Add mmap() and munmap() methods to low level API.  Currently
-       this is only useful for CUSE
-
        * Update retrieve_reply() method
 
 2011-12-05  Miklos Szeredi <miklos@szeredi.hu>
index b8824fbb4ff77a142ad80fa773be7d66a33ddc3f..e147fa26d96fb0692ea7626ed0683343459c0643 100644 (file)
@@ -63,13 +63,6 @@ struct cuse_lowlevel_ops {
                       const void *in_buf, size_t in_bufsz, size_t out_bufsz);
        void (*poll) (fuse_req_t req, struct fuse_file_info *fi,
                      struct fuse_pollhandle *ph);
-       void (*mmap) (fuse_req_t req, uint64_t addr, size_t length,
-                     int prot, int flags, off_t offset,
-                     struct fuse_file_info *fi);
-       void (*munmap) (fuse_req_t req, uint64_t map_id, size_t length,
-                       struct fuse_file_info *fi);
-       void (*retrieve_reply) (fuse_req_t req, void *cookie, uint64_t map_id,
-                               off_t offset, struct fuse_bufvec *bufv);
 };
 
 struct fuse_session *cuse_lowlevel_new(struct fuse_args *args,
index 89e941ac778653af041457578fc0a68b10bde6f2..7b43cb016d6c1a551c5b278f6217bf0669086d49 100644 (file)
@@ -80,7 +80,6 @@
  * 7.18
  *  - add FUSE_IOCTL_DIR flag
  *  - add FUSE_NOTIFY_DELETE
- *  - add FUSE_MMAP and FUSE_MUNMAP
  */
 
 #ifndef _LINUX_FUSE_H
@@ -310,8 +309,6 @@ enum fuse_opcode {
        FUSE_POLL          = 40,
        FUSE_NOTIFY_REPLY  = 41,
        FUSE_BATCH_FORGET  = 42,
-       FUSE_MMAP          = 43,
-       FUSE_MUNMAP        = 44,
 
        /* CUSE specific operations */
        CUSE_INIT          = 4096,
@@ -605,28 +602,6 @@ struct fuse_notify_poll_wakeup_out {
        __u64   kh;
 };
 
-struct fuse_mmap_in {
-       __u64   fh;
-       __u64   addr;
-       __u64   len;
-       __u32   prot;
-       __u32   flags;
-       __u64   offset;
-};
-
-struct fuse_mmap_out {
-       __u64   mapid;          /* Mmap ID, same namespace as Inode ID */
-       __u64   size;           /* Size of memory region */
-       __u64   reserved;
-};
-
-struct fuse_munmap_in {
-       __u64   fh;
-       __u64   mapid;
-       __u64   size;           /* Size of memory region */
-       __u64   reserved;
-};
-
 struct fuse_in_header {
        __u32   len;
        __u32   opcode;
index d4fb229d50727f85f0df880bf0ba056e58ef0aca..3ecc46e7746cacfe2c31da9ec994f4354df7baf0 100644 (file)
@@ -996,37 +996,6 @@ struct fuse_lowlevel_ops {
         */
        void (*flock) (fuse_req_t req, fuse_ino_t ino,
                       struct fuse_file_info *fi, int op);
-
-       /**
-        * Direct mmap (CUSE only for now)
-        *
-        * @param req request handle
-        * @param ino the inode number
-        * @param addr starting address (in clients address space)
-        * @param length length of the mapping
-        * @param prot desired memory protection of the mapping
-        * @param flags mmap flags
-        * @param fi file information
-        *
-        * Introduced in version 2.9
-        */
-       void (*mmap) (fuse_req_t req, fuse_ino_t ino, uint64_t addr,
-                     size_t length, int prot, int flags, off_t offset,
-                     struct fuse_file_info *fi);
-
-       /**
-        * Direct munmap (CUSE only for now)
-        *
-        * @param req request handle
-        * @param ino the inode number
-        * @param map_id identifies the mapping
-        * @param length length of the mapping
-        * @param fi file information
-        *
-        * Introduced in version 2.9
-        */
-       void (*munmap) (fuse_req_t req, fuse_ino_t ino, uint64_t map_id,
-                       size_t length, struct fuse_file_info *fi);
 };
 
 /**
@@ -1316,18 +1285,6 @@ int fuse_reply_ioctl_iov(fuse_req_t req, int result, const struct iovec *iov,
  */
 int fuse_reply_poll(fuse_req_t req, unsigned revents);
 
-/**
- * Reply to an mmap request
- *
- * Possible requests:
- *   mmap
- *
- * @param req request handle
- * @param map_id identifies the mapping
- * @param length length of the mapping (from zero offset)
- */
-int fuse_reply_mmap(fuse_req_t req, uint64_t map_id, size_t length);
-
 /* ----------------------------------------------------------- *
  * Notification                                                       *
  * ----------------------------------------------------------- */
index 7bd289aaec0183dde33f878667860c8f3024b78e..402cf4bd1f5262fff609fe65c693abf1df3a5e72 100644 (file)
@@ -93,28 +93,6 @@ static void cuse_fll_poll(fuse_req_t req, fuse_ino_t ino,
        req_clop(req)->poll(req, fi, ph);
 }
 
-static void cuse_fll_mmap(fuse_req_t req, fuse_ino_t ino, uint64_t addr,
-                         size_t length, int prot, int flags, off_t offset,
-                         struct fuse_file_info *fi)
-{
-       (void)ino;
-       req_clop(req)->mmap(req, addr, length, prot, flags, offset, fi);
-}
-
-static void cuse_fll_munmap(fuse_req_t req, fuse_ino_t ino, uint64_t map_id,
-                           size_t length, struct fuse_file_info *fi)
-{
-       (void)ino;
-       req_clop(req)->munmap(req, map_id, length, fi);
-}
-
-static void cuse_fll_retrieve_reply(fuse_req_t req, void *cookie,
-                                   fuse_ino_t ino, off_t offset,
-                                   struct fuse_bufvec *bufv)
-{
-       req_clop(req)->retrieve_reply(req, cookie, ino, offset, bufv);
-}
-
 static size_t cuse_pack_info(int argc, const char **argv, char *buf)
 {
        size_t size = 0;
@@ -191,10 +169,6 @@ struct fuse_session *cuse_lowlevel_new(struct fuse_args *args,
        lop.fsync       = clop->fsync           ? cuse_fll_fsync        : NULL;
        lop.ioctl       = clop->ioctl           ? cuse_fll_ioctl        : NULL;
        lop.poll        = clop->poll            ? cuse_fll_poll         : NULL;
-       lop.mmap        = clop->mmap            ? cuse_fll_mmap         : NULL;
-       lop.munmap      = clop->munmap          ? cuse_fll_munmap       : NULL;
-       lop.retrieve_reply = clop->retrieve_reply ?
-               cuse_fll_retrieve_reply : NULL;
 
        se = fuse_lowlevel_new_common(args, &lop, sizeof(lop), userdata);
        if (!se) {
index b1c7a2498a4090e675c3d64d3a0ceadf357307f2..a0d4887655c2dea4028c1aec0cd4d3901466f814 100644 (file)
@@ -969,17 +969,6 @@ int fuse_reply_poll(fuse_req_t req, unsigned revents)
        return send_reply_ok(req, &arg, sizeof(arg));
 }
 
-int fuse_reply_mmap(fuse_req_t req, uint64_t map_id, size_t length)
-{
-       struct fuse_mmap_out arg;
-
-       memset(&arg, 0, sizeof(arg));
-       arg.mapid = map_id;
-       arg.size = length;
-
-       return send_reply_ok(req, &arg, sizeof(arg));
-}
-
 static void do_lookup(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
 {
        char *name = (char *) inarg;
@@ -1728,38 +1717,6 @@ static void do_poll(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
        }
 }
 
-static void do_mmap(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
-{
-       struct fuse_mmap_in *arg = (struct fuse_mmap_in *) inarg;
-       struct fuse_file_info fi;
-
-       memset(&fi, 0, sizeof(fi));
-       fi.fh = arg->fh;
-       fi.fh_old = fi.fh;
-
-       if (req->f->op.mmap)
-               req->f->op.mmap(req, nodeid, arg->addr, arg->len, arg->prot,
-                               arg->flags, arg->offset, &fi);
-       else
-               fuse_reply_err(req, ENOSYS);
-
-}
-
-static void do_munmap(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
-{
-       struct fuse_munmap_in *arg = (struct fuse_munmap_in *) inarg;
-       struct fuse_file_info fi;
-
-       memset(&fi, 0, sizeof(fi));
-       fi.fh = arg->fh;
-       fi.fh_old = fi.fh;
-
-       if (req->f->op.munmap)
-               req->f->op.munmap(req, nodeid, arg->mapid, arg->size, &fi);
-       else
-               fuse_reply_err(req, ENOSYS);
-}
-
 static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
 {
        struct fuse_init_in *arg = (struct fuse_init_in *) inarg;
@@ -2304,8 +2261,6 @@ static struct {
        [FUSE_DESTROY]     = { do_destroy,     "DESTROY"     },
        [FUSE_NOTIFY_REPLY] = { (void *) 1,    "NOTIFY_REPLY" },
        [FUSE_BATCH_FORGET] = { do_batch_forget, "BATCH_FORGET" },
-       [FUSE_MMAP]        = { do_mmap, "MMAP" },
-       [FUSE_MUNMAP]      = { do_munmap, "MUNMAP" },
        [CUSE_INIT]        = { cuse_lowlevel_init, "CUSE_INIT"   },
 };
 
index 95bc7d9b5fe4c8589938e23be52bbb1139c85d88..8fbaa51c2668440286107ce349248dd610062d1a 100644 (file)
@@ -194,7 +194,6 @@ FUSE_2.9 {
                fuse_start_cleanup_thread;
                fuse_stop_cleanup_thread;
                fuse_clean_cache;
-               fuse_reply_mmap;
                fuse_lowlevel_notify_delete;
 
        local: