fuse: use true,false for bool variable
authorzhengbin <zhengbin13@huawei.com>
Tue, 14 Jan 2020 12:39:45 +0000 (20:39 +0800)
committerMiklos Szeredi <mszeredi@redhat.com>
Thu, 6 Feb 2020 15:39:28 +0000 (16:39 +0100)
Fixes coccicheck warning:

fs/fuse/readdir.c:335:1-19: WARNING: Assignment of 0/1 to bool variable
fs/fuse/file.c:1398:2-19: WARNING: Assignment of 0/1 to bool variable
fs/fuse/file.c:1400:2-20: WARNING: Assignment of 0/1 to bool variable
fs/fuse/cuse.c:454:1-20: WARNING: Assignment of 0/1 to bool variable
fs/fuse/cuse.c:455:1-19: WARNING: Assignment of 0/1 to bool variable
fs/fuse/inode.c:497:2-17: WARNING: Assignment of 0/1 to bool variable
fs/fuse/inode.c:504:2-23: WARNING: Assignment of 0/1 to bool variable
fs/fuse/inode.c:511:2-22: WARNING: Assignment of 0/1 to bool variable
fs/fuse/inode.c:518:2-23: WARNING: Assignment of 0/1 to bool variable
fs/fuse/inode.c:522:2-26: WARNING: Assignment of 0/1 to bool variable
fs/fuse/inode.c:526:2-18: WARNING: Assignment of 0/1 to bool variable
fs/fuse/inode.c:1000:1-20: WARNING: Assignment of 0/1 to bool variable

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/cuse.c
fs/fuse/file.c
fs/fuse/inode.c
fs/fuse/readdir.c

index 00015d85138297b1c5e87158d75714e4a49a23dd..030f094910c39ed7953242268af992adaf4bb3a2 100644 (file)
@@ -451,8 +451,8 @@ static int cuse_send_init(struct cuse_conn *cc)
        ap->args.out_args[0].size = sizeof(ia->out);
        ap->args.out_args[0].value = &ia->out;
        ap->args.out_args[1].size = CUSE_INIT_INFO_MAX;
-       ap->args.out_argvar = 1;
-       ap->args.out_pages = 1;
+       ap->args.out_argvar = true;
+       ap->args.out_pages = true;
        ap->num_pages = 1;
        ap->pages = &ia->page;
        ap->descs = &ia->desc;
index 3dd37a998ea93a1b92722612d00860e9347d66bd..9d67b830fb7a25445bfd4f930c6ef7fa66fbbd1e 100644 (file)
@@ -1409,9 +1409,9 @@ static int fuse_get_user_pages(struct fuse_args_pages *ap, struct iov_iter *ii,
        }
 
        if (write)
-               ap->args.in_pages = 1;
+               ap->args.in_pages = true;
        else
-               ap->args.out_pages = 1;
+               ap->args.out_pages = true;
 
        *nbytesp = nbytes;
 
index 16aec32f7f3d71767746a886a95e8dfd151d24de..77fef29ebe4fc5bfee8ef99b9d430b04d6cff372 100644 (file)
@@ -494,36 +494,36 @@ static int fuse_parse_param(struct fs_context *fc, struct fs_parameter *param)
 
        case OPT_FD:
                ctx->fd = result.uint_32;
-               ctx->fd_present = 1;
+               ctx->fd_present = true;
                break;
 
        case OPT_ROOTMODE:
                if (!fuse_valid_type(result.uint_32))
                        return invalf(fc, "fuse: Invalid rootmode");
                ctx->rootmode = result.uint_32;
-               ctx->rootmode_present = 1;
+               ctx->rootmode_present = true;
                break;
 
        case OPT_USER_ID:
                ctx->user_id = make_kuid(fc->user_ns, result.uint_32);
                if (!uid_valid(ctx->user_id))
                        return invalf(fc, "fuse: Invalid user_id");
-               ctx->user_id_present = 1;
+               ctx->user_id_present = true;
                break;
 
        case OPT_GROUP_ID:
                ctx->group_id = make_kgid(fc->user_ns, result.uint_32);
                if (!gid_valid(ctx->group_id))
                        return invalf(fc, "fuse: Invalid group_id");
-               ctx->group_id_present = 1;
+               ctx->group_id_present = true;
                break;
 
        case OPT_DEFAULT_PERMISSIONS:
-               ctx->default_permissions = 1;
+               ctx->default_permissions = true;
                break;
 
        case OPT_ALLOW_OTHER:
-               ctx->allow_other = 1;
+               ctx->allow_other = true;
                break;
 
        case OPT_MAX_READ:
@@ -997,7 +997,7 @@ void fuse_send_init(struct fuse_conn *fc)
        /* Variable length argument used for backward compatibility
           with interface version < 7.5.  Rest of init_out is zeroed
           by do_get_request(), so a short reply is not a problem */
-       ia->args.out_argvar = 1;
+       ia->args.out_argvar = true;
        ia->args.out_args[0].size = sizeof(ia->out);
        ia->args.out_args[0].value = &ia->out;
        ia->args.force = true;
index 6a40f75a0d25ed84d149070c4a9c439896ec2c90..90e3f01bd796bbc6a50c97f417205c8e9821c967 100644 (file)
@@ -332,7 +332,7 @@ static int fuse_readdir_uncached(struct file *file, struct dir_context *ctx)
                return -ENOMEM;
 
        plus = fuse_use_readdirplus(inode, ctx);
-       ap->args.out_pages = 1;
+       ap->args.out_pages = true;
        ap->num_pages = 1;
        ap->pages = &page;
        ap->descs = &desc;