From 153d65ff6bb7ac3b6f981af027559b00bbfc69f8 Mon Sep 17 00:00:00 2001 From: Bernd Schubert Date: Tue, 4 Jun 2024 14:00:07 +0200 Subject: [PATCH] Rename struct fuse_req::ctr to ::ref_cnt ref_cnt should make the intention of this variable more clear. --- lib/fuse_i.h | 2 +- lib/fuse_lowlevel.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/fuse_i.h b/lib/fuse_i.h index a856782..1519ce0 100644 --- a/lib/fuse_i.h +++ b/lib/fuse_i.h @@ -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; diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 92f7a99..fc46882 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -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! * -- 2.30.2