sys/vfs/fuse: Cleanup (use TAILQ_FOREACH())
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Mon, 1 Apr 2019 15:25:36 +0000 (00:25 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Mon, 1 Apr 2019 15:50:20 +0000 (00:50 +0900)
Didn't need to use safe version.

sys/vfs/fuse/fuse_device.c
sys/vfs/fuse/fuse_ipc.c

index 5efc311..ef17ad9 100644 (file)
@@ -157,11 +157,10 @@ fuse_device_write(struct dev_write_args *ap)
 {
        struct uio *uio = ap->a_uio;
        struct fuse_mount *fmp;
-       struct fuse_ipc *fip, *tmp;
+       struct fuse_ipc *fip;
        struct fuse_buf fb;
        struct fuse_in_header *ihd;
        struct fuse_out_header *ohd;
-       bool found = false;
        int error;
 
        error = devfs_get_cdevpriv(ap->a_fp, (void**)&fmp);
@@ -180,16 +179,15 @@ fuse_device_write(struct dev_write_args *ap)
        ohd = fb.buf;
 
        mtx_lock(&fmp->ipc_lock);
-       TAILQ_FOREACH_MUTABLE(fip, &fmp->reply_head, reply_entry, tmp) {
+       TAILQ_FOREACH(fip, &fmp->reply_head, reply_entry) {
                if (fip->unique == ohd->unique) {
                        TAILQ_REMOVE(&fmp->reply_head, fip, reply_entry);
-                       found = true;
                        break;
                }
        }
        mtx_unlock(&fmp->ipc_lock);
 
-       if (!found) {
+       if (!fip) {
                fuse_dbg("unique=%ju not found\n", ohd->unique);
                fuse_buf_free(&fb);
                return ENOMSG;
index 84102ce..a142677 100644 (file)
@@ -117,16 +117,16 @@ static void
 fuse_ipc_remove(struct fuse_ipc *fip)
 {
        struct fuse_mount *fmp = fip->fmp;
-       struct fuse_ipc *p, *tmp;
+       struct fuse_ipc *p;
 
        mtx_lock(&fmp->ipc_lock);
-       TAILQ_FOREACH_MUTABLE(p, &fmp->request_head, request_entry, tmp) {
+       TAILQ_FOREACH(p, &fmp->request_head, request_entry) {
                if (fip == p) {
                        TAILQ_REMOVE(&fmp->request_head, p, request_entry);
                        break;
                }
        }
-       TAILQ_FOREACH_MUTABLE(p, &fmp->reply_head, reply_entry, tmp) {
+       TAILQ_FOREACH(p, &fmp->reply_head, reply_entry) {
                if (fip == p) {
                        TAILQ_REMOVE(&fmp->reply_head, p, reply_entry);
                        break;