fuse_lowlevel_notify_*: take struct fuse_session instead of struct fuse_chan
authorNikolaus Rath <Nikolaus@rath.org>
Sun, 18 Sep 2016 02:29:19 +0000 (19:29 -0700)
committerNikolaus Rath <Nikolaus@rath.org>
Wed, 28 Sep 2016 03:45:26 +0000 (20:45 -0700)
The only struct fuse_chan that's available to the user application is
the one that is returned by fuse_mount. However, this is also
permanently available from struct fuse_session.

A later patch will therefore remove struct fuse_chan from the
public API completely. This patch prepares for this by changing the
fuse_lowlevel_notify_* functions to take a struct fuse_session
parameter instead of a struct fuse_chan parameter.

ChangeLog.rst
include/fuse_lowlevel.h
lib/fuse_lowlevel.c

index f4eb6b5beb91f68b298c32c4616e3ce3f07bce87..28888bf5ec8ce2fd97d51ee3543addc8ef1aacce 100644 (file)
@@ -1,6 +1,9 @@
 Unreleased Changes
 ==================
 
+* The ``fuse_lowlevel_notify_*`` functions now all take a `struct
+  fuse_session` parameter instead of a `struct fuse_chan`.
+
 * The channel interface (``fuse_chan_*`` functions) has been
   made private. The `struct fuse_chan_ops` data structure is now
   opaque.
index a01dbf6c724de30b9fb8745629eff9731f285514..4ae0b9ce956825354236fcd033b0d50c0a271ca4 100644 (file)
@@ -1394,14 +1394,14 @@ int fuse_lowlevel_notify_poll(struct fuse_pollhandle *ph);
 /**
  * Notify to invalidate cache for an inode
  *
- * @param ch the channel through which to send the invalidation
+ * @param se the session object
  * @param ino the inode number
  * @param off the offset in the inode where to start invalidating
  *            or negative to invalidate attributes only
  * @param len the amount of cache to invalidate or 0 for all
  * @return zero for success, -errno for failure
  */
-int fuse_lowlevel_notify_inval_inode(struct fuse_chan *ch, fuse_ino_t ino,
+int fuse_lowlevel_notify_inval_inode(struct fuse_session *se, fuse_ino_t ino,
                                     off_t off, off_t len);
 
 /**
@@ -1412,13 +1412,13 @@ int fuse_lowlevel_notify_inval_inode(struct fuse_chan *ch, fuse_ino_t ino,
  * don't call it with a lock held that can also be held by a filesystem
  * operation.
  *
- * @param ch the channel through which to send the invalidation
+ * @param se the session object
  * @param parent inode number
  * @param name file name
  * @param namelen strlen() of file name
  * @return zero for success, -errno for failure
  */
-int fuse_lowlevel_notify_inval_entry(struct fuse_chan *ch, fuse_ino_t parent,
+int fuse_lowlevel_notify_inval_entry(struct fuse_session *se, fuse_ino_t parent,
                                     const char *name, size_t namelen);
 
 /**
@@ -1430,14 +1430,14 @@ int fuse_lowlevel_notify_inval_entry(struct fuse_chan *ch, fuse_ino_t parent,
  * don't call it with a lock held that can also be held by a filesystem
  * operation.
  *
- * @param ch the channel through which to send the notification
+ * @param se the session object
  * @param parent inode number
  * @param child inode number
  * @param name file name
  * @param namelen strlen() of file name
  * @return zero for success, -errno for failure
  */
-int fuse_lowlevel_notify_delete(struct fuse_chan *ch,
+int fuse_lowlevel_notify_delete(struct fuse_session *se,
                                fuse_ino_t parent, fuse_ino_t child,
                                const char *name, size_t namelen);
 
@@ -1455,14 +1455,14 @@ int fuse_lowlevel_notify_delete(struct fuse_chan *ch,
  * If this function returns an error, then the store wasn't fully
  * completed, but it may have been partially completed.
  *
- * @param ch the channel through which to send the invalidation
+ * @param se the session object
  * @param ino the inode number
  * @param offset the starting offset into the file to store to
  * @param bufv buffer vector
  * @param flags flags controlling the copy
  * @return zero for success, -errno for failure
  */
-int fuse_lowlevel_notify_store(struct fuse_chan *ch, fuse_ino_t ino,
+int fuse_lowlevel_notify_store(struct fuse_session *se, fuse_ino_t ino,
                               off_t offset, struct fuse_bufvec *bufv,
                               enum fuse_buf_copy_flags flags);
 /**
@@ -1483,14 +1483,14 @@ int fuse_lowlevel_notify_store(struct fuse_chan *ch, fuse_ino_t ino,
  * buffer.  For dirty pages the write() method will be called
  * regardless of having been retrieved previously.
  *
- * @param ch the channel through which to send the invalidation
+ * @param se the session object
  * @param ino the inode number
  * @param size the number of bytes to retrieve
  * @param offset the starting offset into the file to retrieve from
  * @param cookie user data to supply to the reply callback
  * @return zero for success, -errno for failure
  */
-int fuse_lowlevel_notify_retrieve(struct fuse_chan *ch, fuse_ino_t ino,
+int fuse_lowlevel_notify_retrieve(struct fuse_session *se, fuse_ino_t ino,
                                  size_t size, off_t offset, void *cookie);
 
 
index 0e4083c2377e80952b8cbe4a55be9bb666b62418..9b595158ad0d21b4a9eb1ed30469ffd8a777fd6a 100755 (executable)
@@ -2112,17 +2112,17 @@ int fuse_lowlevel_notify_poll(struct fuse_pollhandle *ph)
        }
 }
 
-int fuse_lowlevel_notify_inval_inode(struct fuse_chan *ch, fuse_ino_t ino,
+int fuse_lowlevel_notify_inval_inode(struct fuse_session *se, fuse_ino_t ino,
                                     off_t off, off_t len)
 {
        struct fuse_notify_inval_inode_out outarg;
        struct fuse_ll *f;
        struct iovec iov[2];
 
-       if (!ch)
+       if (!se)
                return -EINVAL;
 
-       f = fuse_chan_session(ch)->f;
+       f = se->f;
        if (!f)
                return -ENODEV;
 
@@ -2133,20 +2133,20 @@ int fuse_lowlevel_notify_inval_inode(struct fuse_chan *ch, fuse_ino_t ino,
        iov[1].iov_base = &outarg;
        iov[1].iov_len = sizeof(outarg);
 
-       return send_notify_iov(f, ch, FUSE_NOTIFY_INVAL_INODE, iov, 2);
+       return send_notify_iov(f, se->ch, FUSE_NOTIFY_INVAL_INODE, iov, 2);
 }
 
-int fuse_lowlevel_notify_inval_entry(struct fuse_chan *ch, fuse_ino_t parent,
+int fuse_lowlevel_notify_inval_entry(struct fuse_session *se, fuse_ino_t parent,
                                     const char *name, size_t namelen)
 {
        struct fuse_notify_inval_entry_out outarg;
        struct fuse_ll *f;
        struct iovec iov[3];
 
-       if (!ch)
+       if (!se)
                return -EINVAL;
 
-       f = fuse_chan_session(ch)->f;
+       f = se->f;
        if (!f)
                return -ENODEV;
 
@@ -2159,10 +2159,10 @@ int fuse_lowlevel_notify_inval_entry(struct fuse_chan *ch, fuse_ino_t parent,
        iov[2].iov_base = (void *)name;
        iov[2].iov_len = namelen + 1;
 
-       return send_notify_iov(f, ch, FUSE_NOTIFY_INVAL_ENTRY, iov, 3);
+       return send_notify_iov(f, se->ch, FUSE_NOTIFY_INVAL_ENTRY, iov, 3);
 }
 
-int fuse_lowlevel_notify_delete(struct fuse_chan *ch,
+int fuse_lowlevel_notify_delete(struct fuse_session *se,
                                fuse_ino_t parent, fuse_ino_t child,
                                const char *name, size_t namelen)
 {
@@ -2170,10 +2170,10 @@ int fuse_lowlevel_notify_delete(struct fuse_chan *ch,
        struct fuse_ll *f;
        struct iovec iov[3];
 
-       if (!ch)
+       if (!se)
                return -EINVAL;
 
-       f = fuse_chan_session(ch)->f;
+       f = se->f;
        if (!f)
                return -ENODEV;
 
@@ -2190,10 +2190,10 @@ int fuse_lowlevel_notify_delete(struct fuse_chan *ch,
        iov[2].iov_base = (void *)name;
        iov[2].iov_len = namelen + 1;
 
-       return send_notify_iov(f, ch, FUSE_NOTIFY_DELETE, iov, 3);
+       return send_notify_iov(f, se->ch, FUSE_NOTIFY_DELETE, iov, 3);
 }
 
-int fuse_lowlevel_notify_store(struct fuse_chan *ch, fuse_ino_t ino,
+int fuse_lowlevel_notify_store(struct fuse_session *se, fuse_ino_t ino,
                               off_t offset, struct fuse_bufvec *bufv,
                               enum fuse_buf_copy_flags flags)
 {
@@ -2204,10 +2204,10 @@ int fuse_lowlevel_notify_store(struct fuse_chan *ch, fuse_ino_t ino,
        size_t size = fuse_buf_size(bufv);
        int res;
 
-       if (!ch)
+       if (!se)
                return -EINVAL;
 
-       f = fuse_chan_session(ch)->f;
+       f = se->f;
        if (!f)
                return -ENODEV;
 
@@ -2227,7 +2227,7 @@ int fuse_lowlevel_notify_store(struct fuse_chan *ch, fuse_ino_t ino,
        iov[1].iov_base = &outarg;
        iov[1].iov_len = sizeof(outarg);
 
-       res = fuse_send_data_iov(f, ch, iov, 2, bufv, flags);
+       res = fuse_send_data_iov(f, se->ch, iov, 2, bufv, flags);
        if (res > 0)
                res = -res;
 
@@ -2278,7 +2278,7 @@ out:
                fuse_ll_clear_pipe(f);
 }
 
-int fuse_lowlevel_notify_retrieve(struct fuse_chan *ch, fuse_ino_t ino,
+int fuse_lowlevel_notify_retrieve(struct fuse_session *se, fuse_ino_t ino,
                                  size_t size, off_t offset, void *cookie)
 {
        struct fuse_notify_retrieve_out outarg;
@@ -2287,10 +2287,10 @@ int fuse_lowlevel_notify_retrieve(struct fuse_chan *ch, fuse_ino_t ino,
        struct fuse_retrieve_req *rreq;
        int err;
 
-       if (!ch)
+       if (!se)
                return -EINVAL;
 
-       f = fuse_chan_session(ch)->f;
+       f = se->f;
        if (!f)
                return -ENODEV;
 
@@ -2316,7 +2316,7 @@ int fuse_lowlevel_notify_retrieve(struct fuse_chan *ch, fuse_ino_t ino,
        iov[1].iov_base = &outarg;
        iov[1].iov_len = sizeof(outarg);
 
-       err = send_notify_iov(f, ch, FUSE_NOTIFY_RETRIEVE, iov, 2);
+       err = send_notify_iov(f, se->ch, FUSE_NOTIFY_RETRIEVE, iov, 2);
        if (err) {
                pthread_mutex_lock(&f->lock);
                list_del_nreq(&rreq->nreq);