Rename struct fuse_req::ctr to ::ref_cnt
authorBernd Schubert <bschubert@ddn.com>
Tue, 4 Jun 2024 12:00:07 +0000 (14:00 +0200)
committerBernd Schubert <bschubert@ddn.com>
Tue, 4 Jun 2024 12:00:55 +0000 (14:00 +0200)
ref_cnt should make the intention of this variable more clear.

lib/fuse_i.h
lib/fuse_lowlevel.c

index a856782cf449d194a25779b5d77b4ee018443efe..1519ce06fdac3bf478300237ba198f5b120abae3 100644 (file)
@@ -14,7 +14,7 @@ struct mount_opts;
 struct fuse_req {
        struct fuse_session *se;
        uint64_t unique;
-       _Atomic int ctr;
+       _Atomic int ref_cnt;
        pthread_mutex_t lock;
        struct fuse_ctx ctx;
        struct fuse_chan *ch;
index 92f7a9977a0e799b8b71e83022e5b30523fe56e5..fc4688247e9bb7cf17f4da73bb71c79cc4fd1296 100644 (file)
@@ -135,7 +135,7 @@ void fuse_free_req(fuse_req_t req)
        struct fuse_session *se = req->se;
 
        if (se->conn.no_interrupt) {
-               ctr = --req->ctr;
+               ctr = --req->ref_cnt;
                fuse_chan_put(req->ch);
                req->ch = NULL;
        } else {
@@ -143,7 +143,7 @@ void fuse_free_req(fuse_req_t req)
                req->u.ni.func = NULL;
                req->u.ni.data = NULL;
                list_del_req(req);
-               ctr = --req->ctr;
+               ctr = --req->ref_cnt;
                fuse_chan_put(req->ch);
                req->ch = NULL;
                pthread_mutex_unlock(&se->lock);
@@ -161,7 +161,7 @@ static struct fuse_req *fuse_ll_alloc_req(struct fuse_session *se)
                fuse_log(FUSE_LOG_ERR, "fuse: failed to allocate request\n");
        } else {
                req->se = se;
-               req->ctr = 1;
+               req->ref_cnt = 1;
                list_init_req(req);
                pthread_mutex_init(&req->lock, NULL);
        }
@@ -1763,7 +1763,7 @@ static int find_interrupted(struct fuse_session *se, struct fuse_req *req)
                        fuse_interrupt_func_t func;
                        void *data;
 
-                       curr->ctr++;
+                       curr->ref_cnt++;
                        pthread_mutex_unlock(&se->lock);
 
                        /* Ugh, ugly locking */
@@ -1778,8 +1778,8 @@ static int find_interrupted(struct fuse_session *se, struct fuse_req *req)
                        pthread_mutex_unlock(&curr->lock);
 
                        pthread_mutex_lock(&se->lock);
-                       curr->ctr--;
-                       if (!curr->ctr) {
+                       curr->ref_cnt--;
+                       if (!curr->ref_cnt) {
                                destroy_req(curr);
                        }
 
@@ -2113,7 +2113,7 @@ void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
         */
 
        se->conn.time_gran = 1;
-       
+
        if (bufsize < FUSE_MIN_READ_BUFFER) {
                fuse_log(FUSE_LOG_ERR, "fuse: warning: buffer size too small: %zu\n",
                        bufsize);
@@ -2361,7 +2361,7 @@ int fuse_lowlevel_notify_inval_inode(struct fuse_session *se, fuse_ino_t ino,
 
        if (se->conn.proto_minor < 12)
                return -ENOSYS;
-       
+
        outarg.ino = ino;
        outarg.off = off;
        outarg.len = len;
@@ -2374,13 +2374,13 @@ int fuse_lowlevel_notify_inval_inode(struct fuse_session *se, fuse_ino_t ino,
 
 /**
  * Notify parent attributes and the dentry matching parent/name
- * 
+ *
  * Underlying base function for fuse_lowlevel_notify_inval_entry() and
  * fuse_lowlevel_notify_expire_entry().
- * 
+ *
  * @warning
  * Only checks if fuse_lowlevel_notify_inval_entry() is supported by
- * the kernel. All other flags will fall back to 
+ * the kernel. All other flags will fall back to
  * fuse_lowlevel_notify_inval_entry() if not supported!
  * DO THE PROPER CHECKS IN THE DERIVED FUNCTION!
  *