Commit a7a3b1e9 authored by Benjamin Coddington's avatar Benjamin Coddington Committed by Anna Schumaker

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: default avatarBenjamin Coddington <bcodding@redhat.com>
Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
parent 18fe6a23
...@@ -151,7 +151,7 @@ struct nfs_cache_array { ...@@ -151,7 +151,7 @@ struct nfs_cache_array {
struct nfs_cache_array_entry array[0]; 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 { typedef struct {
struct file *file; struct file *file;
struct page *page; struct page *page;
...@@ -165,8 +165,8 @@ typedef struct { ...@@ -165,8 +165,8 @@ typedef struct {
unsigned long timestamp; unsigned long timestamp;
unsigned long gencount; unsigned long gencount;
unsigned int cache_entry_index; unsigned int cache_entry_index;
unsigned int plus:1; bool plus;
unsigned int eof:1; bool eof;
} nfs_readdir_descriptor_t; } nfs_readdir_descriptor_t;
/* /*
...@@ -355,7 +355,7 @@ int nfs_readdir_xdr_filler(struct page **pages, nfs_readdir_descriptor_t *desc, ...@@ -355,7 +355,7 @@ int nfs_readdir_xdr_filler(struct page **pages, nfs_readdir_descriptor_t *desc,
if (error == -ENOTSUPP && desc->plus) { if (error == -ENOTSUPP && desc->plus) {
NFS_SERVER(inode)->caps &= ~NFS_CAP_READDIRPLUS; NFS_SERVER(inode)->caps &= ~NFS_CAP_READDIRPLUS;
clear_bit(NFS_INO_ADVISE_RDPLUS, &NFS_I(inode)->flags); clear_bit(NFS_INO_ADVISE_RDPLUS, &NFS_I(inode)->flags);
desc->plus = 0; desc->plus = false;
goto again; goto again;
} }
goto error; goto error;
...@@ -557,7 +557,7 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en ...@@ -557,7 +557,7 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en
count++; count++;
if (desc->plus != 0) if (desc->plus)
nfs_prime_dcache(file_dentry(desc->file), entry); nfs_prime_dcache(file_dentry(desc->file), entry);
status = nfs_readdir_add_to_array(entry, page); status = nfs_readdir_add_to_array(entry, page);
...@@ -860,7 +860,7 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx) ...@@ -860,7 +860,7 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx)
desc->ctx = ctx; desc->ctx = ctx;
desc->dir_cookie = &dir_ctx->dir_cookie; desc->dir_cookie = &dir_ctx->dir_cookie;
desc->decode = NFS_PROTO(inode)->decode_dirent; 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)) if (ctx->pos == 0 || nfs_attribute_cache_expired(inode))
res = nfs_revalidate_mapping(inode, file->f_mapping); res = nfs_revalidate_mapping(inode, file->f_mapping);
...@@ -885,8 +885,8 @@ static int nfs_readdir(struct file *file, struct dir_context *ctx) ...@@ -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); clear_bit(NFS_INO_ADVISE_RDPLUS, &NFS_I(inode)->flags);
nfs_zap_caches(inode); nfs_zap_caches(inode);
desc->page_index = 0; desc->page_index = 0;
desc->plus = 0; desc->plus = false;
desc->eof = 0; desc->eof = false;
continue; continue;
} }
if (res < 0) if (res < 0)
......
...@@ -272,17 +272,17 @@ static inline bool nfs_match_open_context(const struct nfs_open_context *ctx1, ...@@ -272,17 +272,17 @@ static inline bool nfs_match_open_context(const struct nfs_open_context *ctx1,
/* nfs2xdr.c */ /* nfs2xdr.c */
extern const struct rpc_procinfo nfs_procedures[]; extern const struct rpc_procinfo nfs_procedures[];
extern int nfs2_decode_dirent(struct xdr_stream *, extern int nfs2_decode_dirent(struct xdr_stream *,
struct nfs_entry *, int); struct nfs_entry *, bool);
/* nfs3xdr.c */ /* nfs3xdr.c */
extern const struct rpc_procinfo nfs3_procedures[]; extern const struct rpc_procinfo nfs3_procedures[];
extern int nfs3_decode_dirent(struct xdr_stream *, extern int nfs3_decode_dirent(struct xdr_stream *,
struct nfs_entry *, int); struct nfs_entry *, bool);
/* nfs4xdr.c */ /* nfs4xdr.c */
#if IS_ENABLED(CONFIG_NFS_V4) #if IS_ENABLED(CONFIG_NFS_V4)
extern int nfs4_decode_dirent(struct xdr_stream *, extern int nfs4_decode_dirent(struct xdr_stream *,
struct nfs_entry *, int); struct nfs_entry *, bool);
#endif #endif
#ifdef CONFIG_NFS_V4_1 #ifdef CONFIG_NFS_V4_1
extern const u32 nfs41_maxread_overhead; extern const u32 nfs41_maxread_overhead;
......
...@@ -939,7 +939,7 @@ static int nfs2_xdr_dec_writeres(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -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 nfs2_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
int plus) bool plus)
{ {
__be32 *p; __be32 *p;
int error; int error;
......
...@@ -621,7 +621,7 @@ nfs3_proc_rmdir(struct inode *dir, const struct qstr *name) ...@@ -621,7 +621,7 @@ nfs3_proc_rmdir(struct inode *dir, const struct qstr *name)
*/ */
static int static int
nfs3_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, 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); struct inode *dir = d_inode(dentry);
__be32 *verf = NFS_I(dir)->cookieverf; __be32 *verf = NFS_I(dir)->cookieverf;
......
...@@ -1991,7 +1991,7 @@ static int nfs3_xdr_dec_link3res(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -1991,7 +1991,7 @@ static int nfs3_xdr_dec_link3res(struct rpc_rqst *req, struct xdr_stream *xdr,
* }; * };
*/ */
int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
int plus) bool plus)
{ {
struct nfs_entry old = *entry; struct nfs_entry old = *entry;
__be32 *p; __be32 *p;
......
...@@ -1037,11 +1037,11 @@ struct nfs4_opendata { ...@@ -1037,11 +1037,11 @@ struct nfs4_opendata {
struct nfs4_state *state; struct nfs4_state *state;
struct iattr attrs; struct iattr attrs;
unsigned long timestamp; unsigned long timestamp;
unsigned int rpc_done : 1; bool rpc_done;
unsigned int file_created : 1; bool file_created;
unsigned int is_recover : 1; bool is_recover;
bool cancelled;
int rpc_status; int rpc_status;
int cancelled;
}; };
static bool nfs4_clear_cap_atomic_open_v1(struct nfs_server *server, 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) ...@@ -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); nfs4_stateid_copy(&data->o_res.stateid, &data->c_res.stateid);
nfs_confirm_seqid(&data->owner->so_seqid, 0); nfs_confirm_seqid(&data->owner->so_seqid, 0);
renew_lease(data->o_res.server, data->timestamp); 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) ...@@ -1975,7 +1975,7 @@ static void nfs4_open_confirm_release(void *calldata)
struct nfs4_state *state = NULL; struct nfs4_state *state = NULL;
/* If this request hasn't been cancelled, do nothing */ /* If this request hasn't been cancelled, do nothing */
if (data->cancelled == 0) if (!data->cancelled)
goto out_free; goto out_free;
/* In case of error, no cleanup! */ /* In case of error, no cleanup! */
if (!data->rpc_done) if (!data->rpc_done)
...@@ -2018,7 +2018,7 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data) ...@@ -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); nfs4_init_sequence(&data->c_arg.seq_args, &data->c_res.seq_res, 1);
kref_get(&data->kref); kref_get(&data->kref);
data->rpc_done = 0; data->rpc_done = false;
data->rpc_status = 0; data->rpc_status = 0;
data->timestamp = jiffies; data->timestamp = jiffies;
if (data->is_recover) if (data->is_recover)
...@@ -2028,7 +2028,7 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data) ...@@ -2028,7 +2028,7 @@ static int _nfs4_proc_open_confirm(struct nfs4_opendata *data)
return PTR_ERR(task); return PTR_ERR(task);
status = rpc_wait_for_completion_task(task); status = rpc_wait_for_completion_task(task);
if (status != 0) { if (status != 0) {
data->cancelled = 1; data->cancelled = true;
smp_wmb(); smp_wmb();
} else } else
status = data->rpc_status; status = data->rpc_status;
...@@ -2127,7 +2127,7 @@ static void nfs4_open_done(struct rpc_task *task, void *calldata) ...@@ -2127,7 +2127,7 @@ static void nfs4_open_done(struct rpc_task *task, void *calldata)
if (!(data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM)) if (!(data->o_res.rflags & NFS4_OPEN_RESULT_CONFIRM))
nfs_confirm_seqid(&data->owner->so_seqid, 0); nfs_confirm_seqid(&data->owner->so_seqid, 0);
} }
data->rpc_done = 1; data->rpc_done = true;
} }
static void nfs4_open_release(void *calldata) static void nfs4_open_release(void *calldata)
...@@ -2136,7 +2136,7 @@ static void nfs4_open_release(void *calldata) ...@@ -2136,7 +2136,7 @@ static void nfs4_open_release(void *calldata)
struct nfs4_state *state = NULL; struct nfs4_state *state = NULL;
/* If this request hasn't been cancelled, do nothing */ /* If this request hasn't been cancelled, do nothing */
if (data->cancelled == 0) if (!data->cancelled)
goto out_free; goto out_free;
/* In case of error, no cleanup! */ /* In case of error, no cleanup! */
if (data->rpc_status != 0 || !data->rpc_done) if (data->rpc_status != 0 || !data->rpc_done)
...@@ -2182,20 +2182,20 @@ static int nfs4_run_open_task(struct nfs4_opendata *data, int isrecover) ...@@ -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); nfs4_init_sequence(&o_arg->seq_args, &o_res->seq_res, 1);
kref_get(&data->kref); kref_get(&data->kref);
data->rpc_done = 0; data->rpc_done = false;
data->rpc_status = 0; data->rpc_status = 0;
data->cancelled = 0; data->cancelled = false;
data->is_recover = 0; data->is_recover = false;
if (isrecover) { if (isrecover) {
nfs4_set_sequence_privileged(&o_arg->seq_args); nfs4_set_sequence_privileged(&o_arg->seq_args);
data->is_recover = 1; data->is_recover = true;
} }
task = rpc_run_task(&task_setup_data); task = rpc_run_task(&task_setup_data);
if (IS_ERR(task)) if (IS_ERR(task))
return PTR_ERR(task); return PTR_ERR(task);
status = rpc_wait_for_completion_task(task); status = rpc_wait_for_completion_task(task);
if (status != 0) { if (status != 0) {
data->cancelled = 1; data->cancelled = true;
smp_wmb(); smp_wmb();
} else } else
status = data->rpc_status; status = data->rpc_status;
...@@ -2290,9 +2290,9 @@ static int _nfs4_proc_open(struct nfs4_opendata *data) ...@@ -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_CREAT) {
if (o_arg->open_flags & O_EXCL) 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) 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) if (data->file_created || dir->i_version != o_res->cinfo.after)
update_changeattr(dir, &o_res->cinfo, update_changeattr(dir, &o_res->cinfo,
o_res->f_attr->time_start); o_res->f_attr->time_start);
...@@ -4275,7 +4275,7 @@ static int nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry, ...@@ -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, 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 inode *dir = d_inode(dentry);
struct nfs4_readdir_arg args = { struct nfs4_readdir_arg args = {
...@@ -4313,7 +4313,7 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, ...@@ -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, 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 = { }; struct nfs4_exception exception = { };
int err; int err;
...@@ -6137,7 +6137,7 @@ static void nfs4_lock_release(void *calldata) ...@@ -6137,7 +6137,7 @@ static void nfs4_lock_release(void *calldata)
dprintk("%s: begin!\n", __func__); dprintk("%s: begin!\n", __func__);
nfs_free_seqid(data->arg.open_seqid); nfs_free_seqid(data->arg.open_seqid);
if (data->cancelled != 0) { if (data->cancelled) {
struct rpc_task *task; struct rpc_task *task;
task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp, task = nfs4_do_unlck(&data->fl, data->ctx, data->lsp,
data->arg.lock_seqid); data->arg.lock_seqid);
...@@ -6220,7 +6220,7 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f ...@@ -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, nfs4_handle_setlk_error(data->server, data->lsp,
data->arg.new_lock_owner, ret); data->arg.new_lock_owner, ret);
} else } else
data->cancelled = 1; data->cancelled = true;
rpc_put_task(task); rpc_put_task(task);
dprintk("%s: done, ret = %d!\n", __func__, ret); dprintk("%s: done, ret = %d!\n", __func__, ret);
trace_nfs4_set_lock(fl, state, &data->res.stateid, cmd, ret); trace_nfs4_set_lock(fl, state, &data->res.stateid, cmd, ret);
......
...@@ -7447,7 +7447,7 @@ static int nfs4_xdr_dec_free_stateid(struct rpc_rqst *rqstp, ...@@ -7447,7 +7447,7 @@ static int nfs4_xdr_dec_free_stateid(struct rpc_rqst *rqstp,
* on a directory already in our cache. * on a directory already in our cache.
*/ */
int nfs4_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, int nfs4_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
int plus) bool plus)
{ {
unsigned int savep; unsigned int savep;
uint32_t bitmap[3] = {0}; uint32_t bitmap[3] = {0};
......
...@@ -485,7 +485,7 @@ nfs_proc_rmdir(struct inode *dir, const struct qstr *name) ...@@ -485,7 +485,7 @@ nfs_proc_rmdir(struct inode *dir, const struct qstr *name)
*/ */
static int static int
nfs_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, 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 inode *dir = d_inode(dentry);
struct nfs_readdirargs arg = { struct nfs_readdirargs arg = {
......
...@@ -878,7 +878,7 @@ struct nfs3_readdirargs { ...@@ -878,7 +878,7 @@ struct nfs3_readdirargs {
struct nfs_fh * fh; struct nfs_fh * fh;
__u64 cookie; __u64 cookie;
__be32 verf[2]; __be32 verf[2];
int plus; bool plus;
unsigned int count; unsigned int count;
struct page ** pages; struct page ** pages;
}; };
...@@ -909,7 +909,7 @@ struct nfs3_linkres { ...@@ -909,7 +909,7 @@ struct nfs3_linkres {
struct nfs3_readdirres { struct nfs3_readdirres {
struct nfs_fattr * dir_attr; struct nfs_fattr * dir_attr;
__be32 * verf; __be32 * verf;
int plus; bool plus;
}; };
struct nfs3_getaclres { struct nfs3_getaclres {
...@@ -1053,7 +1053,7 @@ struct nfs4_readdir_arg { ...@@ -1053,7 +1053,7 @@ struct nfs4_readdir_arg {
struct page ** pages; /* zero-copy data */ struct page ** pages; /* zero-copy data */
unsigned int pgbase; /* zero-copy data */ unsigned int pgbase; /* zero-copy data */
const u32 * bitmask; const u32 * bitmask;
int plus; bool plus;
}; };
struct nfs4_readdir_res { struct nfs4_readdir_res {
...@@ -1585,7 +1585,7 @@ struct nfs_rpc_ops { ...@@ -1585,7 +1585,7 @@ struct nfs_rpc_ops {
int (*mkdir) (struct inode *, struct dentry *, struct iattr *); int (*mkdir) (struct inode *, struct dentry *, struct iattr *);
int (*rmdir) (struct inode *, const struct qstr *); int (*rmdir) (struct inode *, const struct qstr *);
int (*readdir) (struct dentry *, struct rpc_cred *, 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 *, int (*mknod) (struct inode *, struct dentry *, struct iattr *,
dev_t); dev_t);
int (*statfs) (struct nfs_server *, struct nfs_fh *, int (*statfs) (struct nfs_server *, struct nfs_fh *,
...@@ -1595,7 +1595,7 @@ struct nfs_rpc_ops { ...@@ -1595,7 +1595,7 @@ struct nfs_rpc_ops {
int (*pathconf) (struct nfs_server *, struct nfs_fh *, int (*pathconf) (struct nfs_server *, struct nfs_fh *,
struct nfs_pathconf *); struct nfs_pathconf *);
int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); 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 *, int (*pgio_rpc_prepare)(struct rpc_task *,
struct nfs_pgio_header *); struct nfs_pgio_header *);
void (*read_setup)(struct nfs_pgio_header *, struct rpc_message *); void (*read_setup)(struct nfs_pgio_header *, struct rpc_message *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment