From f00795452566901e80d1094e81f9c26461b2a9cd Mon Sep 17 00:00:00 2001 From: Nikolaus Rath Date: Mon, 28 Mar 2016 13:48:15 -0700 Subject: [PATCH] Inlined fuse_chan_fd --- include/fuse_lowlevel.h | 8 -------- lib/fuse.c | 2 +- lib/fuse_loop_mt.c | 2 +- lib/fuse_lowlevel.c | 12 ++++++------ lib/fuse_session.c | 5 ----- 5 files changed, 8 insertions(+), 21 deletions(-) diff --git a/include/fuse_lowlevel.h b/include/fuse_lowlevel.h index 32908cb..9bdd655 100644 --- a/include/fuse_lowlevel.h +++ b/include/fuse_lowlevel.h @@ -1701,14 +1701,6 @@ int fuse_session_loop_mt(struct fuse_session *se); * Channel interface * * ----------------------------------------------------------- */ -/** - * Query the file descriptor of the channel - * - * @param ch the channel - * @return the file descriptor passed to fuse_chan_new() - */ -int fuse_chan_fd(struct fuse_chan *ch); - /** * Obtain counted reference to the channel * diff --git a/lib/fuse.c b/lib/fuse.c index 2f1c85e..781efb2 100644 --- a/lib/fuse.c +++ b/lib/fuse.c @@ -4320,7 +4320,7 @@ static int fuse_session_loop_remember(struct fuse *f) time_t next_clean; struct fuse_chan *ch = fuse_session_chan(se); struct pollfd fds = { - .fd = fuse_chan_fd(ch), + .fd = ch->fd, .events = POLLIN }; struct fuse_buf fbuf = { diff --git a/lib/fuse_loop_mt.c b/lib/fuse_loop_mt.c index 6d7f051..036f75c 100755 --- a/lib/fuse_loop_mt.c +++ b/lib/fuse_loop_mt.c @@ -193,7 +193,7 @@ static struct fuse_chan *fuse_clone_chan(struct fuse_mt *mt) } fcntl(clonefd, F_SETFD, FD_CLOEXEC); - masterfd = fuse_chan_fd(mt->prevch); + masterfd = mt->prevch->fd; res = ioctl(clonefd, FUSE_DEV_IOC_CLONE, &masterfd); if (res == -1) { fprintf(stderr, "fuse: failed to clone device fd: %s\n", diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index 3acb663..4fe3678 100755 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -160,9 +160,9 @@ static struct fuse_req *fuse_ll_alloc_req(struct fuse_ll *f) void fuse_chan_close(struct fuse_chan *ch) { - int fd = fuse_chan_fd(ch); + int fd = ch->fd; if (fd != -1) - close(fd); + close(fd); } @@ -188,7 +188,7 @@ static int fuse_send_msg(struct fuse_ll *f, struct fuse_chan *ch, } } - ssize_t res = writev(fuse_chan_fd(ch), iov, count); + ssize_t res = writev(ch->fd, iov, count); int err = errno; if (res == -1) { @@ -777,7 +777,7 @@ static int fuse_send_data_iov(struct fuse_ll *f, struct fuse_chan *ch, splice_flags |= SPLICE_F_MOVE; res = splice(llp->pipe[0], NULL, - fuse_chan_fd(ch), NULL, out->len, splice_flags); + ch->fd, NULL, out->len, splice_flags); if (res == -1) { res = -errno; perror("fuse: splice from pipe"); @@ -2728,7 +2728,7 @@ int fuse_session_receive_buf(struct fuse_session *se, struct fuse_buf *buf, goto fallback; } - res = splice(fuse_chan_fd(ch), NULL, llp->pipe[1], NULL, bufsize, 0); + res = splice(ch->fd, NULL, llp->pipe[1], NULL, bufsize, 0); err = errno; if (fuse_session_exited(se)) @@ -2812,7 +2812,7 @@ fallback: } restart: - res = read(fuse_chan_fd(ch), buf->mem, f->bufsize); + res = read(ch->fd, buf->mem, f->bufsize); err = errno; if (fuse_session_exited(se)) diff --git a/lib/fuse_session.c b/lib/fuse_session.c index 42fe5c3..6b54e43 100644 --- a/lib/fuse_session.c +++ b/lib/fuse_session.c @@ -90,11 +90,6 @@ struct fuse_chan *fuse_chan_new(int fd) return ch; } -int fuse_chan_fd(struct fuse_chan *ch) -{ - return ch->fd; -} - struct fuse_session *fuse_chan_session(struct fuse_chan *ch) { return ch->se; -- 2.30.2