NFS: convert flags to bool
NFS uses some int, and unsigned int :1, and bool as flags in structs and args. Assert the preference for uniformly replacing these with the bool type. Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
Родитель
18fe6a23e3
Коммит
a7a3b1e971
16
fs/nfs/dir.c
16
fs/nfs/dir.c
|
@ -151,7 +151,7 @@ struct nfs_cache_array {
|
|||
struct nfs_cache_array_entry array[0];
|
||||
};
|
||||
|
||||
typedef int (*decode_dirent_t)(struct xdr_stream *, struct nfs_entry *, int);
|
||||
typedef int (*decode_dirent_t)(struct xdr_stream *, struct nfs_entry *, bool);
|
||||
typedef struct {
|
||||
struct file *file;
|
||||
struct page *page;
|
||||
|
@ -165,8 +165,8 @@ typedef struct {
|
|||
unsigned long timestamp;
|
||||
unsigned long gencount;
|
||||
unsigned int cache_entry_index;
|
||||
unsigned int plus:1;
|
||||
unsigned int eof:1;
|
||||
bool plus;
|
||||
bool eof;
|
||||
} nfs_readdir_descriptor_t;
|
||||
|
||||
/*
|
||||
|
@ -355,7 +355,7 @@ int nfs_readdir_xdr_filler(struct page **pages, nfs_readdir_descriptor_t *desc,
|
|||
if (error == -ENOTSUPP && desc->plus) {
|
||||
NFS_SERVER(inode)->caps &= ~NFS_CAP_READDIRPLUS;
|
||||
clear_bit(NFS_INO_ADVISE_RDPLUS, &NFS_I(inode)->flags);
|
||||
desc->plus = 0;
|
||||
desc->plus = false;
|
||||
goto again;
|
||||
}
|
||||
goto error;
|
||||
|
@ -557,7 +557,7 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en
|
|||
|
||||
count++;
|
||||
|
||||
if (desc->plus != 0)
|
||||
if (desc->plus)
|
||||
nfs_prime_dcache(file_dentry(desc->file), entry);
|
||||
|
||||
status = nfs_readdir_add_to_array(entry, page);
|
||||
|
@ -860,7 +860,7 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx)
|
|||
desc->ctx = ctx;
|
||||
desc->dir_cookie = &dir_ctx->dir_cookie;
|
||||
desc->decode = NFS_PROTO(inode)->decode_dirent;
|
||||
desc->plus = nfs_use_readdirplus(inode, ctx) ? 1 : 0;
|
||||
desc->plus = nfs_use_readdirplus(inode, ctx);
|
||||
|
||||
if (ctx->pos == 0 || nfs_attribute_cache_expired(inode))
|
||||
res = nfs_revalidate_mapping(inode, file->f_mapping);
|
||||
|
@ -885,8 +885,8 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx)
|
|||
clear_bit(NFS_INO_ADVISE_RDPLUS, &NFS_I(inode)->flags);
|
||||
nfs_zap_caches(inode);
|
||||
desc->page_index = 0;
|
||||
desc->plus = 0;
|
||||
desc->eof = 0;
|
||||
desc->plus = false;
|
||||
desc->eof = false;
|
||||
continue;
|
||||
}
|
||||
if (res < 0)
|
||||
|
|
|
@ -272,17 +272,17 @@ static inline bool nfs_match_open_context(const struct nfs_open_context *ctx1,
|
|||
/* nfs2xdr.c */
|
||||
extern const struct rpc_procinfo nfs_procedures[];
|
||||
extern int nfs2_decode_dirent(struct xdr_stream *,
|
||||
struct nfs_entry *, int);
|
||||
struct nfs_entry *, bool);
|
||||
|
||||
/* nfs3xdr.c */
|
||||
extern const struct rpc_procinfo nfs3_procedures[];
|
||||
extern int nfs3_decode_dirent(struct xdr_stream *,
|
||||
struct nfs_entry *, int);
|
||||
struct nfs_entry *, bool);
|
||||
|
||||
/* nfs4xdr.c */
|
||||
#if IS_ENABLED(CONFIG_NFS_V4)
|
||||
extern int nfs4_decode_dirent(struct xdr_stream *,
|
||||
struct nfs_entry *, int);
|
||||
struct nfs_entry *, bool);
|
||||
#endif
|
||||
#ifdef CONFIG_NFS_V4_1
|
||||
extern const u32 nfs41_maxread_overhead;
|
||||
|
|
|
@ -939,7 +939,7 @@ static int nfs2_xdr_dec_writeres(struct rpc_rqst *req, struct xdr_stream *xdr,
|
|||
* };
|
||||
*/
|
||||
int nfs2_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
|
||||
int plus)
|
||||
bool plus)
|
||||
{
|
||||
__be32 *p;
|
||||
int error;
|
||||
|
|
|
@ -621,7 +621,7 @@ out:
|
|||
*/
|
||||
static int
|
||||
nfs3_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
|
||||
u64 cookie, struct page **pages, unsigned int count, int plus)
|
||||
u64 cookie, struct page **pages, unsigned int count, bool plus)
|
||||
{
|
||||
struct inode *dir = d_inode(dentry);
|
||||
__be32 *verf = NFS_I(dir)->cookieverf;
|
||||
|
|
|
@ -1991,7 +1991,7 @@ out_status:
|
|||
* };
|
||||
*/
|
||||
int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
|
||||
int plus)
|
||||
bool plus)
|
||||
{
|
||||
struct nfs_entry old = *entry;
|
||||
__be32 *p;
|
||||
|
|
|
@ -1037,11 +1037,11 @@ struct nfs4_opendata {
|
|||
struct nfs4_state *state;
|
||||
struct iattr attrs;
|
||||
unsigned long timestamp;
|
||||
unsigned int rpc_done : 1;
|
||||
unsigned int file_created : 1;
|
||||
unsigned int is_recover : 1;
|
||||
bool rpc_done;
|
||||
bool file_created;
|
||||
bool is_recover;
|
||||
bool cancelled;
|
||||
int rpc_status;
|
||||
int cancelled;
|
||||
};
|
||||
|
||||
static bool nfs4_clear_cap_atomic_open_v1(struct nfs_server *server,
|
||||
|
@ -1965,7 +1965,7 @@ static void nfs4_open_confirm_done(struct rpc_task *task, void *calldata)
|
|||
nfs4_stateid_copy(&data->o_res.stateid, &data->c_res.stateid);
|
||||
nfs_confirm_seqid(&data->owner->so_seqid, 0);
|
||||
renew_lease(data->o_res.server, data->timestamp);
|
||||
data->rpc_done = 1;
|
||||
data->rpc_done = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1975,7 +1975,7 @@ static void nfs4_open_confirm_release(void *calldata)
|
|||
struct nfs4_state *state = NULL;
|
||||
|
||||
/* If this request hasn't been cancelled, do nothing */
|
||||
if (data->cancelled == 0)
|
||||
if (!data->cancelled)
|
||||
goto out_free;
|
||||
/* In case of error, no cleanup! */
|
||||
if (!data->rpc_done)
|
||||
|
@ -2018,7 +2018,7 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data)
|
|||
|
||||
nfs4_init_sequence(&data->c_arg.seq_args, &data->c_res.seq_res, 1);
|
||||
kref_get(&data->kref);
|
||||
data->rpc_done = 0;
|
||||
data->rpc_done = false;
|
||||
data->rpc_status = 0;
|
||||
data->timestamp = jiffies;
|
||||
if (data->is_recover)
|
||||
|
@ -2028,7 +2028,7 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data)
|
|||
return PTR_ERR(task);
|
||||
status = rpc_wait_for_completion_task(task);
|
||||
if (status != 0) {
|
||||
data->cancelled = 1;
|
||||
data->cancelled = true;
|
||||
smp_wmb();
|
||||
} else
|
||||
status = data->rpc_status;
|
||||
|
@ -2127,7 +2127,7 @@ static void nfs4_open_done(struct rpc_task *task, void *calldata)
|
|||
if (!(data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM))
|
||||
nfs_confirm_seqid(&data->owner->so_seqid, 0);
|
||||
}
|
||||
data->rpc_done = 1;
|
||||
data->rpc_done = true;
|
||||
}
|
||||
|
||||
static void nfs4_open_release(void *calldata)
|
||||
|
@ -2136,7 +2136,7 @@ static void nfs4_open_release(void *calldata)
|
|||
struct nfs4_state *state = NULL;
|
||||
|
||||
/* If this request hasn't been cancelled, do nothing */
|
||||
if (data->cancelled == 0)
|
||||
if (!data->cancelled)
|
||||
goto out_free;
|
||||
/* In case of error, no cleanup! */
|
||||
if (data->rpc_status != 0 || !data->rpc_done)
|
||||
|
@ -2182,20 +2182,20 @@ static int nfs4_run_open_task(struct nfs4_opendata *data, int isrecover)
|
|||
|
||||
nfs4_init_sequence(&o_arg->seq_args, &o_res->seq_res, 1);
|
||||
kref_get(&data->kref);
|
||||
data->rpc_done = 0;
|
||||
data->rpc_done = false;
|
||||
data->rpc_status = 0;
|
||||
data->cancelled = 0;
|
||||
data->is_recover = 0;
|
||||
data->cancelled = false;
|
||||
data->is_recover = false;
|
||||
if (isrecover) {
|
||||
nfs4_set_sequence_privileged(&o_arg->seq_args);
|
||||
data->is_recover = 1;
|
||||
data->is_recover = true;
|
||||
}
|
||||
task = rpc_run_task(&task_setup_data);
|
||||
if (IS_ERR(task))
|
||||
return PTR_ERR(task);
|
||||
status = rpc_wait_for_completion_task(task);
|
||||
if (status != 0) {
|
||||
data->cancelled = 1;
|
||||
data->cancelled = true;
|
||||
smp_wmb();
|
||||
} else
|
||||
status = data->rpc_status;
|
||||
|
@ -2290,9 +2290,9 @@ static int _nfs4_proc_open(struct nfs4_opendata *data)
|
|||
|
||||
if (o_arg->open_flags & O_CREAT) {
|
||||
if (o_arg->open_flags & O_EXCL)
|
||||
data->file_created = 1;
|
||||
data->file_created = true;
|
||||
else if (o_res->cinfo.before != o_res->cinfo.after)
|
||||
data->file_created = 1;
|
||||
data->file_created = true;
|
||||
if (data->file_created || dir->i_version != o_res->cinfo.after)
|
||||
update_changeattr(dir, &o_res->cinfo,
|
||||
o_res->f_attr->time_start);
|
||||
|
@ -4275,7 +4275,7 @@ static int nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry,
|
|||
}
|
||||
|
||||
static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
|
||||
u64 cookie, struct page **pages, unsigned int count, int plus)
|
||||
u64 cookie, struct page **pages, unsigned int count, bool plus)
|
||||
{
|
||||
struct inode *dir = d_inode(dentry);
|
||||
struct nfs4_readdir_arg args = {
|
||||
|
@ -4313,7 +4313,7 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
|
|||
}
|
||||
|
||||
static int nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
|
||||
u64 cookie, struct page **pages, unsigned int count, int plus)
|
||||
u64 cookie, struct page **pages, unsigned int count, bool plus)
|
||||
{
|
||||
struct nfs4_exception exception = { };
|
||||
int err;
|
||||
|
@ -6137,7 +6137,7 @@ static void nfs4_lock_release(void *calldata)
|
|||
|
||||
dprintk("%s: begin!\n", __func__);
|
||||
nfs_free_seqid(data->arg.open_seqid);
|
||||
if (data->cancelled != 0) {
|
||||
if (data->cancelled) {
|
||||
struct rpc_task *task;
|
||||
task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp,
|
||||
data->arg.lock_seqid);
|
||||
|
@ -6220,7 +6220,7 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
|
|||
nfs4_handle_setlk_error(data->server, data->lsp,
|
||||
data->arg.new_lock_owner, ret);
|
||||
} else
|
||||
data->cancelled = 1;
|
||||
data->cancelled = true;
|
||||
rpc_put_task(task);
|
||||
dprintk("%s: done, ret = %d!\n", __func__, ret);
|
||||
trace_nfs4_set_lock(fl, state, &data->res.stateid, cmd, ret);
|
||||
|
|
|
@ -7447,7 +7447,7 @@ out:
|
|||
* on a directory already in our cache.
|
||||
*/
|
||||
int nfs4_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
|
||||
int plus)
|
||||
bool plus)
|
||||
{
|
||||
unsigned int savep;
|
||||
uint32_t bitmap[3] = {0};
|
||||
|
|
|
@ -485,7 +485,7 @@ nfs_proc_rmdir(struct inode *dir, const struct qstr *name)
|
|||
*/
|
||||
static int
|
||||
nfs_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
|
||||
u64 cookie, struct page **pages, unsigned int count, int plus)
|
||||
u64 cookie, struct page **pages, unsigned int count, bool plus)
|
||||
{
|
||||
struct inode *dir = d_inode(dentry);
|
||||
struct nfs_readdirargs arg = {
|
||||
|
|
|
@ -878,7 +878,7 @@ struct nfs3_readdirargs {
|
|||
struct nfs_fh * fh;
|
||||
__u64 cookie;
|
||||
__be32 verf[2];
|
||||
int plus;
|
||||
bool plus;
|
||||
unsigned int count;
|
||||
struct page ** pages;
|
||||
};
|
||||
|
@ -909,7 +909,7 @@ struct nfs3_linkres {
|
|||
struct nfs3_readdirres {
|
||||
struct nfs_fattr * dir_attr;
|
||||
__be32 * verf;
|
||||
int plus;
|
||||
bool plus;
|
||||
};
|
||||
|
||||
struct nfs3_getaclres {
|
||||
|
@ -1053,7 +1053,7 @@ struct nfs4_readdir_arg {
|
|||
struct page ** pages; /* zero-copy data */
|
||||
unsigned int pgbase; /* zero-copy data */
|
||||
const u32 * bitmask;
|
||||
int plus;
|
||||
bool plus;
|
||||
};
|
||||
|
||||
struct nfs4_readdir_res {
|
||||
|
@ -1585,7 +1585,7 @@ struct nfs_rpc_ops {
|
|||
int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
|
||||
int (*rmdir) (struct inode *, const struct qstr *);
|
||||
int (*readdir) (struct dentry *, struct rpc_cred *,
|
||||
u64, struct page **, unsigned int, int);
|
||||
u64, struct page **, unsigned int, bool);
|
||||
int (*mknod) (struct inode *, struct dentry *, struct iattr *,
|
||||
dev_t);
|
||||
int (*statfs) (struct nfs_server *, struct nfs_fh *,
|
||||
|
@ -1595,7 +1595,7 @@ struct nfs_rpc_ops {
|
|||
int (*pathconf) (struct nfs_server *, struct nfs_fh *,
|
||||
struct nfs_pathconf *);
|
||||
int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
|
||||
int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, int);
|
||||
int (*decode_dirent)(struct xdr_stream *, struct nfs_entry *, bool);
|
||||
int (*pgio_rpc_prepare)(struct rpc_task *,
|
||||
struct nfs_pgio_header *);
|
||||
void (*read_setup)(struct nfs_pgio_header *, struct rpc_message *);
|
||||
|
|
Загрузка…
Ссылка в новой задаче