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>
This commit is contained in:
28
fs/namei.c
28
fs/namei.c
@@ -2196,7 +2196,7 @@ static int may_o_create(struct path *dir, struct dentry *dentry, umode_t mode)
|
|||||||
static struct file *atomic_open(struct nameidata *nd, struct dentry *dentry,
|
static struct file *atomic_open(struct nameidata *nd, struct dentry *dentry,
|
||||||
struct path *path, struct opendata *od,
|
struct path *path, struct opendata *od,
|
||||||
const struct open_flags *op,
|
const struct open_flags *op,
|
||||||
int *want_write, bool need_lookup,
|
bool *want_write, bool need_lookup,
|
||||||
bool *created)
|
bool *created)
|
||||||
{
|
{
|
||||||
struct inode *dir = nd->path.dentry->d_inode;
|
struct inode *dir = nd->path.dentry->d_inode;
|
||||||
@@ -2238,7 +2238,7 @@ static struct file *atomic_open(struct nameidata *nd, struct dentry *dentry,
|
|||||||
(open_flag & O_ACCMODE) != O_RDONLY) {
|
(open_flag & O_ACCMODE) != O_RDONLY) {
|
||||||
error = mnt_want_write(nd->path.mnt);
|
error = mnt_want_write(nd->path.mnt);
|
||||||
if (!error) {
|
if (!error) {
|
||||||
*want_write = 1;
|
*want_write = true;
|
||||||
} else if (!(open_flag & O_CREAT)) {
|
} else if (!(open_flag & O_CREAT)) {
|
||||||
/*
|
/*
|
||||||
* No O_CREATE -> atomicity not a requirement -> fall
|
* No O_CREATE -> atomicity not a requirement -> fall
|
||||||
@@ -2360,7 +2360,7 @@ looked_up:
|
|||||||
static struct file *lookup_open(struct nameidata *nd, struct path *path,
|
static struct file *lookup_open(struct nameidata *nd, struct path *path,
|
||||||
struct opendata *od,
|
struct opendata *od,
|
||||||
const struct open_flags *op,
|
const struct open_flags *op,
|
||||||
int *want_write, bool *created)
|
bool *want_write, bool *created)
|
||||||
{
|
{
|
||||||
struct dentry *dir = nd->path.dentry;
|
struct dentry *dir = nd->path.dentry;
|
||||||
struct inode *dir_inode = dir->d_inode;
|
struct inode *dir_inode = dir->d_inode;
|
||||||
@@ -2405,7 +2405,7 @@ static struct file *lookup_open(struct nameidata *nd, struct path *path,
|
|||||||
error = mnt_want_write(nd->path.mnt);
|
error = mnt_want_write(nd->path.mnt);
|
||||||
if (error)
|
if (error)
|
||||||
goto out_dput;
|
goto out_dput;
|
||||||
*want_write = 1;
|
*want_write = true;
|
||||||
*created = true;
|
*created = true;
|
||||||
error = security_path_mknod(&nd->path, dentry, mode, 0);
|
error = security_path_mknod(&nd->path, dentry, mode, 0);
|
||||||
if (error)
|
if (error)
|
||||||
@@ -2433,13 +2433,13 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
|
|||||||
{
|
{
|
||||||
struct dentry *dir = nd->path.dentry;
|
struct dentry *dir = nd->path.dentry;
|
||||||
int open_flag = op->open_flag;
|
int open_flag = op->open_flag;
|
||||||
int will_truncate = open_flag & O_TRUNC;
|
bool will_truncate = (open_flag & O_TRUNC) != 0;
|
||||||
int want_write = 0;
|
bool want_write = false;
|
||||||
int acc_mode = op->acc_mode;
|
int acc_mode = op->acc_mode;
|
||||||
struct file *filp;
|
struct file *filp;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
bool created;
|
bool created;
|
||||||
int symlink_ok = 0;
|
bool symlink_ok = false;
|
||||||
struct path save_parent = { .dentry = NULL, .mnt = NULL };
|
struct path save_parent = { .dentry = NULL, .mnt = NULL };
|
||||||
bool retried = false;
|
bool retried = false;
|
||||||
int error;
|
int error;
|
||||||
@@ -2476,7 +2476,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
|
|||||||
if (nd->last.name[nd->last.len])
|
if (nd->last.name[nd->last.len])
|
||||||
nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY;
|
nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY;
|
||||||
if (open_flag & O_PATH && !(nd->flags & LOOKUP_FOLLOW))
|
if (open_flag & O_PATH && !(nd->flags & LOOKUP_FOLLOW))
|
||||||
symlink_ok = 1;
|
symlink_ok = true;
|
||||||
/* we _can_ be in RCU mode here */
|
/* we _can_ be in RCU mode here */
|
||||||
error = lookup_fast(nd, &nd->last, path, &inode);
|
error = lookup_fast(nd, &nd->last, path, &inode);
|
||||||
if (likely(!error))
|
if (likely(!error))
|
||||||
@@ -2514,7 +2514,7 @@ retry_lookup:
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if (created || !S_ISREG(filp->f_path.dentry->d_inode->i_mode))
|
if (created || !S_ISREG(filp->f_path.dentry->d_inode->i_mode))
|
||||||
will_truncate = 0;
|
will_truncate = false;
|
||||||
|
|
||||||
audit_inode(pathname, filp->f_path.dentry);
|
audit_inode(pathname, filp->f_path.dentry);
|
||||||
goto opened;
|
goto opened;
|
||||||
@@ -2523,7 +2523,7 @@ retry_lookup:
|
|||||||
if (created) {
|
if (created) {
|
||||||
/* Don't check for write permission, don't truncate */
|
/* Don't check for write permission, don't truncate */
|
||||||
open_flag &= ~O_TRUNC;
|
open_flag &= ~O_TRUNC;
|
||||||
will_truncate = 0;
|
will_truncate = false;
|
||||||
acc_mode = MAY_OPEN;
|
acc_mode = MAY_OPEN;
|
||||||
path_to_nameidata(path, nd);
|
path_to_nameidata(path, nd);
|
||||||
goto finish_open_created;
|
goto finish_open_created;
|
||||||
@@ -2541,7 +2541,7 @@ retry_lookup:
|
|||||||
*/
|
*/
|
||||||
if (want_write) {
|
if (want_write) {
|
||||||
mnt_drop_write(nd->path.mnt);
|
mnt_drop_write(nd->path.mnt);
|
||||||
want_write = 0;
|
want_write = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = -EEXIST;
|
error = -EEXIST;
|
||||||
@@ -2600,13 +2600,13 @@ finish_lookup:
|
|||||||
audit_inode(pathname, nd->path.dentry);
|
audit_inode(pathname, nd->path.dentry);
|
||||||
finish_open:
|
finish_open:
|
||||||
if (!S_ISREG(nd->inode->i_mode))
|
if (!S_ISREG(nd->inode->i_mode))
|
||||||
will_truncate = 0;
|
will_truncate = false;
|
||||||
|
|
||||||
if (will_truncate) {
|
if (will_truncate) {
|
||||||
error = mnt_want_write(nd->path.mnt);
|
error = mnt_want_write(nd->path.mnt);
|
||||||
if (error)
|
if (error)
|
||||||
goto exit;
|
goto exit;
|
||||||
want_write = 1;
|
want_write = true;
|
||||||
}
|
}
|
||||||
finish_open_created:
|
finish_open_created:
|
||||||
error = may_open(&nd->path, acc_mode, open_flag);
|
error = may_open(&nd->path, acc_mode, open_flag);
|
||||||
@@ -2623,7 +2623,7 @@ finish_open_created:
|
|||||||
save_parent.dentry = NULL;
|
save_parent.dentry = NULL;
|
||||||
if (want_write) {
|
if (want_write) {
|
||||||
mnt_drop_write(nd->path.mnt);
|
mnt_drop_write(nd->path.mnt);
|
||||||
want_write = 0;
|
want_write = false;
|
||||||
}
|
}
|
||||||
retried = true;
|
retried = true;
|
||||||
goto retry_lookup;
|
goto retry_lookup;
|
||||||
|
Reference in New Issue
Block a user