diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2012-06-05 09:10:30 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-14 08:33:24 -0400 |
commit | 77d660a8a83036432dc33f092a367d06563d233e (patch) | |
tree | e581b5b0f7bf6b8e49a9ed2a49c5eeb29d181954 | |
parent | e83db167229702da0f48957641e0dbf36b2644aa (diff) |
vfs: do_last(): clean up bool
Consistently use bool for boolean values in do_last().
Reported-by: David Howells <dhowells@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/namei.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/fs/namei.c b/fs/namei.c index ea24376cfa94..6bdb8d732538 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2196,7 +2196,7 @@ static int may_o_create(struct path *dir, struct dentry *dentry, umode_t mode) | |||
2196 | static struct file *atomic_open(struct nameidata *nd, struct dentry *dentry, | 2196 | static struct file *atomic_open(struct nameidata *nd, struct dentry *dentry, |
2197 | struct path *path, struct opendata *od, | 2197 | struct path *path, struct opendata *od, |
2198 | const struct open_flags *op, | 2198 | const struct open_flags *op, |
2199 | int *want_write, bool need_lookup, | 2199 | bool *want_write, bool need_lookup, |
2200 | bool *created) | 2200 | bool *created) |
2201 | { | 2201 | { |
2202 | struct inode *dir = nd->path.dentry->d_inode; | 2202 | struct inode *dir = nd->path.dentry->d_inode; |
@@ -2238,7 +2238,7 @@ static struct file *atomic_open(struct nameidata *nd, struct dentry *dentry, | |||
2238 | (open_flag & O_ACCMODE) != O_RDONLY) { | 2238 | (open_flag & O_ACCMODE) != O_RDONLY) { |
2239 | error = mnt_want_write(nd->path.mnt); | 2239 | error = mnt_want_write(nd->path.mnt); |
2240 | if (!error) { | 2240 | if (!error) { |
2241 | *want_write = 1; | 2241 | *want_write = true; |
2242 | } else if (!(open_flag & O_CREAT)) { | 2242 | } else if (!(open_flag & O_CREAT)) { |
2243 | /* | 2243 | /* |
2244 | * No O_CREATE -> atomicity not a requirement -> fall | 2244 | * No O_CREATE -> atomicity not a requirement -> fall |
@@ -2360,7 +2360,7 @@ looked_up: | |||
2360 | static struct file *lookup_open(struct nameidata *nd, struct path *path, | 2360 | static struct file *lookup_open(struct nameidata *nd, struct path *path, |
2361 | struct opendata *od, | 2361 | struct opendata *od, |
2362 | const struct open_flags *op, | 2362 | const struct open_flags *op, |
2363 | int *want_write, bool *created) | 2363 | bool *want_write, bool *created) |
2364 | { | 2364 | { |
2365 | struct dentry *dir = nd->path.dentry; | 2365 | struct dentry *dir = nd->path.dentry; |
2366 | struct inode *dir_inode = dir->d_inode; | 2366 | struct inode *dir_inode = dir->d_inode; |
@@ -2405,7 +2405,7 @@ static struct file *lookup_open(struct nameidata *nd, struct path *path, | |||
2405 | error = mnt_want_write(nd->path.mnt); | 2405 | error = mnt_want_write(nd->path.mnt); |
2406 | if (error) | 2406 | if (error) |
2407 | goto out_dput; | 2407 | goto out_dput; |
2408 | *want_write = 1; | 2408 | *want_write = true; |
2409 | *created = true; | 2409 | *created = true; |
2410 | error = security_path_mknod(&nd->path, dentry, mode, 0); | 2410 | error = security_path_mknod(&nd->path, dentry, mode, 0); |
2411 | if (error) | 2411 | if (error) |
@@ -2433,13 +2433,13 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
2433 | { | 2433 | { |
2434 | struct dentry *dir = nd->path.dentry; | 2434 | struct dentry *dir = nd->path.dentry; |
2435 | int open_flag = op->open_flag; | 2435 | int open_flag = op->open_flag; |
2436 | int will_truncate = open_flag & O_TRUNC; | 2436 | bool will_truncate = (open_flag & O_TRUNC) != 0; |
2437 | int want_write = 0; | 2437 | bool want_write = false; |
2438 | int acc_mode = op->acc_mode; | 2438 | int acc_mode = op->acc_mode; |
2439 | struct file *filp; | 2439 | struct file *filp; |
2440 | struct inode *inode; | 2440 | struct inode *inode; |
2441 | bool created; | 2441 | bool created; |
2442 | int symlink_ok = 0; | 2442 | bool symlink_ok = false; |
2443 | struct path save_parent = { .dentry = NULL, .mnt = NULL }; | 2443 | struct path save_parent = { .dentry = NULL, .mnt = NULL }; |
2444 | bool retried = false; | 2444 | bool retried = false; |
2445 | int error; | 2445 | int error; |
@@ -2476,7 +2476,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
2476 | if (nd->last.name[nd->last.len]) | 2476 | if (nd->last.name[nd->last.len]) |
2477 | nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY; | 2477 | nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY; |
2478 | if (open_flag & O_PATH && !(nd->flags & LOOKUP_FOLLOW)) | 2478 | if (open_flag & O_PATH && !(nd->flags & LOOKUP_FOLLOW)) |
2479 | symlink_ok = 1; | 2479 | symlink_ok = true; |
2480 | /* we _can_ be in RCU mode here */ | 2480 | /* we _can_ be in RCU mode here */ |
2481 | error = lookup_fast(nd, &nd->last, path, &inode); | 2481 | error = lookup_fast(nd, &nd->last, path, &inode); |
2482 | if (likely(!error)) | 2482 | if (likely(!error)) |
@@ -2514,7 +2514,7 @@ retry_lookup: | |||
2514 | goto out; | 2514 | goto out; |
2515 | 2515 | ||
2516 | if (created || !S_ISREG(filp->f_path.dentry->d_inode->i_mode)) | 2516 | if (created || !S_ISREG(filp->f_path.dentry->d_inode->i_mode)) |
2517 | will_truncate = 0; | 2517 | will_truncate = false; |
2518 | 2518 | ||
2519 | audit_inode(pathname, filp->f_path.dentry); | 2519 | audit_inode(pathname, filp->f_path.dentry); |
2520 | goto opened; | 2520 | goto opened; |
@@ -2523,7 +2523,7 @@ retry_lookup: | |||
2523 | if (created) { | 2523 | if (created) { |
2524 | /* Don't check for write permission, don't truncate */ | 2524 | /* Don't check for write permission, don't truncate */ |
2525 | open_flag &= ~O_TRUNC; | 2525 | open_flag &= ~O_TRUNC; |
2526 | will_truncate = 0; | 2526 | will_truncate = false; |
2527 | acc_mode = MAY_OPEN; | 2527 | acc_mode = MAY_OPEN; |
2528 | path_to_nameidata(path, nd); | 2528 | path_to_nameidata(path, nd); |
2529 | goto finish_open_created; | 2529 | goto finish_open_created; |
@@ -2541,7 +2541,7 @@ retry_lookup: | |||
2541 | */ | 2541 | */ |
2542 | if (want_write) { | 2542 | if (want_write) { |
2543 | mnt_drop_write(nd->path.mnt); | 2543 | mnt_drop_write(nd->path.mnt); |
2544 | want_write = 0; | 2544 | want_write = false; |
2545 | } | 2545 | } |
2546 | 2546 | ||
2547 | error = -EEXIST; | 2547 | error = -EEXIST; |
@@ -2600,13 +2600,13 @@ finish_lookup: | |||
2600 | audit_inode(pathname, nd->path.dentry); | 2600 | audit_inode(pathname, nd->path.dentry); |
2601 | finish_open: | 2601 | finish_open: |
2602 | if (!S_ISREG(nd->inode->i_mode)) | 2602 | if (!S_ISREG(nd->inode->i_mode)) |
2603 | will_truncate = 0; | 2603 | will_truncate = false; |
2604 | 2604 | ||
2605 | if (will_truncate) { | 2605 | if (will_truncate) { |
2606 | error = mnt_want_write(nd->path.mnt); | 2606 | error = mnt_want_write(nd->path.mnt); |
2607 | if (error) | 2607 | if (error) |
2608 | goto exit; | 2608 | goto exit; |
2609 | want_write = 1; | 2609 | want_write = true; |
2610 | } | 2610 | } |
2611 | finish_open_created: | 2611 | finish_open_created: |
2612 | error = may_open(&nd->path, acc_mode, open_flag); | 2612 | error = may_open(&nd->path, acc_mode, open_flag); |
@@ -2623,7 +2623,7 @@ finish_open_created: | |||
2623 | save_parent.dentry = NULL; | 2623 | save_parent.dentry = NULL; |
2624 | if (want_write) { | 2624 | if (want_write) { |
2625 | mnt_drop_write(nd->path.mnt); | 2625 | mnt_drop_write(nd->path.mnt); |
2626 | want_write = 0; | 2626 | want_write = false; |
2627 | } | 2627 | } |
2628 | retried = true; | 2628 | retried = true; |
2629 | goto retry_lookup; | 2629 | goto retry_lookup; |