From e49995acfd026f3ca85d05dc1b91d97a8743fe72 Mon Sep 17 00:00:00 2001 From: Frank Zago Date: Sun, 28 Sep 2014 21:00:59 -0500 Subject: [PATCH] LU-5396 all: use NULL instead of 0 It is preferable to use NULL instead of 0 for pointers. This fixes sparse warnings such as: lustre/fld/fld_request.c:126:17: warning: Using plain integer as NULL pointer The second parameter of class_match_param() was changed to a const, to be able to remove a cast in one user, to prevent splitting a long line. No other code change. Change-Id: Icc7b46cef32685c942f5af970d1610467fee4496 Signed-off-by: frank zago Reviewed-on: http://review.whamcloud.com/12567 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Dmitry Eremin Reviewed-by: John L. Hammond Reviewed-by: Bob Glossman Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- libcfs/include/libcfs/libcfs_ioctl.h | 4 ++-- lnet/lnet/api-ni.c | 4 ++-- lnet/selftest/console.c | 2 +- lustre/fld/fld_request.c | 2 +- lustre/include/lustre_param.h | 2 +- lustre/ldlm/ldlm_internal.h | 2 +- lustre/ldlm/ldlm_lib.c | 4 ++-- lustre/ldlm/ldlm_lockd.c | 2 +- lustre/lfsck/lfsck_layout.c | 8 ++++---- lustre/lfsck/lfsck_lib.c | 4 ++-- lustre/lfsck/lfsck_namespace.c | 28 ++++++++++++++-------------- lustre/lfsck/lfsck_striped_dir.c | 2 +- lustre/llite/llite_lib.c | 4 ++-- lustre/llite/lproc_llite.c | 2 +- lustre/lmv/lproc_lmv.c | 2 +- lustre/lod/lod_object.c | 4 ++-- lustre/lod/lproc_lod.c | 4 ++-- lustre/lov/lov_dev.c | 2 +- lustre/lov/lov_obd.c | 6 +++--- lustre/lov/lov_request.c | 2 +- lustre/lov/lproc_lov.c | 2 +- lustre/mdc/lproc_mdc.c | 2 +- lustre/mdd/mdd_dir.c | 8 ++++---- lustre/mdd/mdd_lproc.c | 2 +- lustre/mdt/mdt_coordinator.c | 2 +- lustre/mdt/mdt_handler.c | 2 +- lustre/mdt/mdt_lproc.c | 2 +- lustre/mdt/mdt_mds.c | 2 +- lustre/mdt/mdt_reint.c | 2 +- lustre/mgc/lproc_mgc.c | 2 +- lustre/mgc/mgc_request.c | 2 +- lustre/mgs/lproc_mgs.c | 2 +- lustre/mgs/mgs_llog.c | 27 ++++++++++++++++----------- lustre/obdclass/linux/linux-module.c | 2 +- lustre/obdclass/obd_config.c | 6 +++--- lustre/obdclass/obd_mount.c | 20 ++++++++++---------- lustre/obdclass/obd_mount_server.c | 12 ++++++------ lustre/obdecho/echo.c | 2 +- lustre/ofd/lproc_ofd.c | 2 +- lustre/ofd/ofd_dev.c | 2 +- lustre/osc/lproc_osc.c | 2 +- lustre/osc/osc_dev.c | 2 +- lustre/osd-ldiskfs/osd_handler.c | 2 +- lustre/osd-ldiskfs/osd_iam.c | 6 +++--- lustre/osd-ldiskfs/osd_iam_lvar.c | 4 ++-- lustre/osd-ldiskfs/osd_lproc.c | 4 ++-- lustre/osd-ldiskfs/osd_scrub.c | 6 +++--- lustre/osp/lproc_osp.c | 4 ++-- lustre/ost/ost_handler.c | 2 +- lustre/ptlrpc/gss/gss_keyring.c | 2 +- lustre/ptlrpc/gss/gss_mech_switch.c | 2 +- lustre/ptlrpc/import.c | 2 +- lustre/ptlrpc/sec.c | 2 +- lustre/quota/qsd_handler.c | 2 +- 54 files changed, 120 insertions(+), 115 deletions(-) diff --git a/libcfs/include/libcfs/libcfs_ioctl.h b/libcfs/include/libcfs/libcfs_ioctl.h index 0b17167..d8206fb 100644 --- a/libcfs/include/libcfs/libcfs_ioctl.h +++ b/libcfs/include/libcfs/libcfs_ioctl.h @@ -225,11 +225,11 @@ static inline bool libcfs_ioctl_is_invalid(struct libcfs_ioctl_data *data) CERROR("LIBCFS ioctl: pbuf2 pointer but 0 length\n"); return 1; } - if (data->ioc_plen1 && data->ioc_pbuf1 == 0) { + if (data->ioc_plen1 && data->ioc_pbuf1 == NULL) { CERROR("LIBCFS ioctl: plen1 nonzero but no pbuf1 pointer\n"); return 1; } - if (data->ioc_plen2 && data->ioc_pbuf2 == 0) { + if (data->ioc_plen2 && data->ioc_pbuf2 == NULL) { CERROR("LIBCFS ioctl: plen2 nonzero but no pbuf2 pointer\n"); return 1; } diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index c077e3f..2333899 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -1107,7 +1107,7 @@ lnet_ping_info_setup(lnet_ping_info_t **ppinfo, lnet_handle_md_t *md_handle, { lnet_handle_me_t me_handle; lnet_process_id_t id = {LNET_NID_ANY, LNET_PID_ANY}; - lnet_md_t md = {0}; + lnet_md_t md = {NULL}; int rc, rc2; if (set_eq) { @@ -2395,7 +2395,7 @@ lnet_ping(lnet_process_id_t id, int timeout_ms, lnet_process_id_t __user *ids, lnet_handle_eq_t eqh; lnet_handle_md_t mdh; lnet_event_t event; - lnet_md_t md = {0}; + lnet_md_t md = { NULL }; int which; int unlinked = 0; int replied = 0; diff --git a/lnet/selftest/console.c b/lnet/selftest/console.c index e6df2ee..5687f32 100644 --- a/lnet/selftest/console.c +++ b/lnet/selftest/console.c @@ -806,7 +806,7 @@ lstcon_group_info(char *name, lstcon_ndlist_ent_t __user *gents_p, return rc; } - if (dents_up != 0) { + if (dents_up != NULL) { /* verbose query */ rc = lstcon_nodes_getent(&grp->grp_ndl_list, index_p, count_p, dents_up); diff --git a/lustre/fld/fld_request.c b/lustre/fld/fld_request.c index 764ab18..43c12b0 100644 --- a/lustre/fld/fld_request.c +++ b/lustre/fld/fld_request.c @@ -123,7 +123,7 @@ struct lu_fld_hash fld_hash[] = { .fh_scan_func = fld_rrb_scan }, { - 0, + NULL, } }; diff --git a/lustre/include/lustre_param.h b/lustre/include/lustre_param.h index 7825d26..9ccd63f 100644 --- a/lustre/include/lustre_param.h +++ b/lustre/include/lustre_param.h @@ -62,7 +62,7 @@ int class_find_param(char *buf, char *key, char **valp); struct cfg_interop_param *class_find_old_param(const char *param, struct cfg_interop_param *ptr); int class_get_next_param(char **params, char *copy); -int class_match_param(char *buf, char *key, char **valp); +int class_match_param(char *buf, const char *key, char **valp); int class_parse_nid(char *buf, lnet_nid_t *nid, char **endh); int class_parse_nid_quiet(char *buf, lnet_nid_t *nid, char **endh); int class_parse_net(char *buf, __u32 *net, char **endh); diff --git a/lustre/ldlm/ldlm_internal.h b/lustre/ldlm/ldlm_internal.h index 56e7859..90da1ff 100644 --- a/lustre/ldlm/ldlm_internal.h +++ b/lustre/ldlm/ldlm_internal.h @@ -298,7 +298,7 @@ ldlm_add_var(struct lprocfs_seq_vars *vars, struct proc_dir_entry *proc_dir, snprintf((char *)vars->name, MAX_STRING_SIZE, "%s", name); vars->data = data; vars->fops = ops; - lprocfs_seq_add_vars(proc_dir, vars, 0); + lprocfs_seq_add_vars(proc_dir, vars, NULL); } static inline int is_granted_or_cancelled(struct ldlm_lock *lock) diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index abef317..8c5ad6b 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -1474,7 +1474,7 @@ void target_cleanup_recovery(struct obd_device *obd) spin_unlock(&obd->obd_recovery_task_lock); list_for_each_entry_safe(req, n, &clean_list, rq_list) { - LASSERT(req->rq_reply_state == 0); + LASSERT(req->rq_reply_state == NULL); target_exp_dequeue_req_replay(req); target_request_copy_put(req); } @@ -1485,7 +1485,7 @@ void target_cleanup_recovery(struct obd_device *obd) spin_unlock(&obd->obd_recovery_task_lock); list_for_each_entry_safe(req, n, &clean_list, rq_list) { - LASSERT(req->rq_reply_state == 0); + LASSERT(req->rq_reply_state == NULL); target_request_copy_put(req); } diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 51e43f0..aba247f 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -2968,7 +2968,7 @@ static int ldlm_setup(void) INIT_LIST_HEAD(&waiting_locks_list); spin_lock_init(&waiting_locks_spinlock); - cfs_timer_init(&waiting_locks_timer, waiting_locks_callback, 0); + cfs_timer_init(&waiting_locks_timer, waiting_locks_callback, NULL); task = kthread_run(expired_lock_main, NULL, "ldlm_elt"); if (IS_ERR(task)) { diff --git a/lustre/lfsck/lfsck_layout.c b/lustre/lfsck/lfsck_layout.c index 033f1b7..b2fa319 100644 --- a/lustre/lfsck/lfsck_layout.c +++ b/lustre/lfsck/lfsck_layout.c @@ -1751,11 +1751,11 @@ static int lfsck_layout_recreate_parent(const struct lu_env *env, struct dt_object *pobj = NULL; struct dt_object *cobj = NULL; struct thandle *th = NULL; - struct lu_buf pbuf = { 0 }; + struct lu_buf pbuf = { NULL }; struct lu_buf *ea_buf = &info->lti_big_buf; struct lu_buf lov_buf; struct lustre_handle lh = { 0 }; - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; struct lu_buf linkea_buf; const struct lu_name *pname; int size = 0; @@ -3201,7 +3201,7 @@ static int lfsck_layout_assistant_handler_p1(const struct lu_env *env, struct lfsck_thread_info *info = lfsck_env_info(env); struct filter_fid_old *pea = &info->lti_old_pfid; struct lu_fid *pfid = &info->lti_fid; - struct lu_buf buf = { 0 }; + struct lu_buf buf = { NULL }; struct dt_object *parent = llr->llr_parent->llo_obj; struct dt_object *child = llr->llr_child; struct lu_attr *pla = &info->lti_la; @@ -4333,7 +4333,7 @@ static int lfsck_layout_master_exec_oit(const struct lu_env *env, struct lov_mds_md_v1 *lmm = NULL; struct dt_device *dev = lfsck->li_bottom; struct lustre_handle lh = { 0 }; - struct lu_buf ea_buf = { 0 }; + struct lu_buf ea_buf = { NULL }; int rc = 0; int size = 0; bool locked = false; diff --git a/lustre/lfsck/lfsck_lib.c b/lustre/lfsck/lfsck_lib.c index 8e31130..28bc0a2 100644 --- a/lustre/lfsck/lfsck_lib.c +++ b/lustre/lfsck/lfsck_lib.c @@ -474,7 +474,7 @@ static int lfsck_create_lpf_local(const struct lu_env *env, struct dt_object *bk_obj = lfsck->li_bookmark_obj; const struct lu_fid *cfid = lfsck_dto2fid(child); struct thandle *th = NULL; - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; struct lu_buf linkea_buf; const struct lu_name *cname; loff_t pos = 0; @@ -617,7 +617,7 @@ static int lfsck_create_lpf_remote(const struct lu_env *env, struct dt_object *bk_obj = lfsck->li_bookmark_obj; const struct lu_fid *cfid = lfsck_dto2fid(child); struct thandle *th = NULL; - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; struct lu_buf linkea_buf; const struct lu_name *cname; struct dt_device *dev; diff --git a/lustre/lfsck/lfsck_namespace.c b/lustre/lfsck/lfsck_namespace.c index 5a5eb48..744b29e 100644 --- a/lustre/lfsck/lfsck_namespace.c +++ b/lustre/lfsck/lfsck_namespace.c @@ -845,7 +845,7 @@ static int lfsck_namespace_insert_orphan(const struct lu_env *env, struct thandle *th = NULL; struct lustre_handle plh = { 0 }; struct lustre_handle clh = { 0 }; - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; struct lu_buf linkea_buf; int namelen; int idx = 0; @@ -1311,7 +1311,7 @@ static int lfsck_namespace_create_orphan_local(const struct lu_env *env, struct dt_object *child = NULL; struct thandle *th = NULL; struct lustre_handle lh = { 0 }; - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; struct lu_buf linkea_buf; struct lu_buf lmv_buf; char name[32]; @@ -1574,7 +1574,7 @@ static int lfsck_namespace_shrink_linkea(const struct lu_env *env, struct lfsck_bookmark *bk = &lfsck->li_bookmark_ram; struct thandle *th = NULL; struct lustre_handle lh = { 0 }; - struct linkea_data ldata_new = { 0 }; + struct linkea_data ldata_new = { NULL }; struct lu_buf linkea_buf; int rc = 0; ENTRY; @@ -1792,7 +1792,7 @@ static int lfsck_namespace_replace_cond(const struct lu_env *env, struct dt_object *obj = NULL; struct lustre_handle plh = { 0 }; struct lustre_handle clh = { 0 }; - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; struct thandle *th = NULL; bool exist = true; int rc = 0; @@ -2198,7 +2198,7 @@ static int lfsck_namespace_repair_unmatched_pairs(const struct lu_env *env, struct lfsck_instance *lfsck = com->lc_lfsck; struct dt_device *dev = lfsck->li_bottom; struct thandle *th = NULL; - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; struct lu_buf linkea_buf; int rc = 0; ENTRY; @@ -2663,7 +2663,7 @@ lfsck_namespace_dsd_multiple(const struct lu_env *env, struct lfsck_instance *lfsck = com->lc_lfsck; struct lfsck_bookmark *bk = &lfsck->li_bookmark_ram; struct dt_object *parent = NULL; - struct linkea_data ldata_new = { 0 }; + struct linkea_data ldata_new = { NULL }; int dirent_count = 0; int linkea_count = 0; int rc = 0; @@ -2908,7 +2908,7 @@ static int lfsck_namespace_repair_nlink(const struct lu_env *env, const struct lu_fid *cfid = lfsck_dto2fid(obj); struct dt_object *child = NULL; struct thandle *th = NULL; - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; struct lustre_handle lh = { 0 }; __u32 old = la->la_nlink; int rc = 0; @@ -3049,7 +3049,7 @@ static int lfsck_namespace_double_scan_dir(const struct lu_env *env, struct lfsck_namespace *ns = com->lc_file_ram; struct lfsck_instance *lfsck = com->lc_lfsck; struct lustre_handle lh = { 0 }; - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; bool unknown = false; bool lpf = false; bool retry = false; @@ -3281,7 +3281,7 @@ static int lfsck_namespace_double_scan_one(const struct lu_env *env, struct lfsck_instance *lfsck = com->lc_lfsck; struct lfsck_namespace *ns = com->lc_file_ram; struct dt_object *parent = NULL; - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; bool repaired = false; int count = 0; int rc; @@ -4042,7 +4042,7 @@ static int lfsck_namespace_exec_oit(const struct lu_env *env, struct dt_device *dev = lfsck->li_bottom; struct seq_server_site *ss = lu_site2seq(dev->dd_lu_dev.ld_site); - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; __u32 idx = lfsck_dev_idx(dev); int rc; ENTRY; @@ -4808,7 +4808,7 @@ int lfsck_namespace_repair_dangling(const struct lu_env *env, struct lmv_mds_md_v1 *lmv2 = &info->lti_lmv2; struct dt_object *parent = lnr->lnr_obj; const struct lu_name *cname; - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; struct lustre_handle lh = { 0 }; struct lu_buf linkea_buf; struct lu_buf lmv_buf; @@ -5015,7 +5015,7 @@ static int lfsck_namespace_assistant_handler_p1(const struct lu_env *env, struct lfsck_instance *lfsck = com->lc_lfsck; struct lfsck_bookmark *bk = &lfsck->li_bookmark_ram; struct lfsck_namespace *ns = com->lc_file_ram; - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; const struct lu_name *cname; struct thandle *handle = NULL; struct lfsck_namespace_req *lnr = @@ -6243,7 +6243,7 @@ int lfsck_verify_linkea(const struct lu_env *env, struct dt_device *dev, struct dt_object *obj, const struct lu_name *cname, const struct lu_fid *pfid) { - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; struct lu_buf linkea_buf; struct thandle *th; int rc; @@ -6322,7 +6322,7 @@ int lfsck_links_get_first(const struct lu_env *env, struct dt_object *obj, char *name, struct lu_fid *pfid) { struct lu_name *cname = &lfsck_env_info(env)->lti_name; - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; int rc; rc = lfsck_links_read(env, obj, &ldata); diff --git a/lustre/lfsck/lfsck_striped_dir.c b/lustre/lfsck/lfsck_striped_dir.c index 6b3f69d..709d4a2 100644 --- a/lustre/lfsck/lfsck_striped_dir.c +++ b/lustre/lfsck/lfsck_striped_dir.c @@ -1917,7 +1917,7 @@ int lfsck_namespace_striped_dir_rescan(const struct lu_env *env, struct lfsck_slave_lmv_rec *lslr = llmv->ll_lslr + i; const struct lu_fid *cfid = &lslr->lslr_fid; const struct lu_name *cname; - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; int len; int rc1 = 0; bool repair_linkea = false; diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 9330a85..de207ab 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -170,7 +170,7 @@ static void ll_free_sbi(struct super_block *sb) static int client_common_fill_super(struct super_block *sb, char *md, char *dt, struct vfsmount *mnt) { - struct inode *root = 0; + struct inode *root = NULL; struct ll_sb_info *sbi = ll_s2sbi(sb); struct obd_device *obd; struct obd_capa *oc = NULL; @@ -2360,7 +2360,7 @@ int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req, struct super_block *sb, struct lookup_intent *it) { struct ll_sb_info *sbi = NULL; - struct lustre_md md = { 0 }; + struct lustre_md md = { NULL }; int rc; ENTRY; diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c index 93074cf..a0aea00 100644 --- a/lustre/llite/lproc_llite.c +++ b/lustre/llite/lproc_llite.c @@ -1024,7 +1024,7 @@ struct lprocfs_seq_vars lprocfs_llite_obd_vars[] = { .fops = &ll_root_squash_fops }, { .name = "nosquash_nids", .fops = &ll_nosquash_nids_fops }, - { 0 } + { NULL } }; #define MAX_STRING_SIZE 128 diff --git a/lustre/lmv/lproc_lmv.c b/lustre/lmv/lproc_lmv.c index 352a578..362b3c6 100644 --- a/lustre/lmv/lproc_lmv.c +++ b/lustre/lmv/lproc_lmv.c @@ -216,7 +216,7 @@ struct lprocfs_seq_vars lprocfs_lmv_obd_vars[] = { .fops = &lmv_uuid_fops }, { .name = "desc_uuid", .fops = &lmv_desc_uuid_fops }, - { 0 } + { NULL } }; struct file_operations lmv_proc_target_fops = { diff --git a/lustre/lod/lod_object.c b/lustre/lod/lod_object.c index 450e7f7..bb9aac4 100644 --- a/lustre/lod/lod_object.c +++ b/lustre/lod/lod_object.c @@ -1811,7 +1811,7 @@ next: struct dt_object *dto = stripe[i]; char *stripe_name = info->lti_key; struct lu_name *sname; - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; struct lu_buf linkea_buf; rc = dt_declare_create(env, dto, attr, NULL, dof, th); @@ -2438,7 +2438,7 @@ static int lod_xattr_set_lmv(const struct lu_env *env, struct dt_object *dt, struct dt_object *dto; char *stripe_name = info->lti_key; struct lu_name *sname; - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; struct lu_buf linkea_buf; dto = lo->ldo_stripe[i]; diff --git a/lustre/lod/lproc_lod.c b/lustre/lod/lproc_lod.c index c3a75af..b6eafe3 100644 --- a/lustre/lod/lproc_lod.c +++ b/lustre/lod/lproc_lod.c @@ -733,7 +733,7 @@ static struct lprocfs_seq_vars lprocfs_lod_obd_vars[] = { .fops = &lod_qos_maxage_fops }, { .name = "lmv_failout", .fops = &lod_lmv_failout_fops }, - { 0 } + { NULL } }; static struct lprocfs_seq_vars lprocfs_lod_osd_vars[] = { @@ -743,7 +743,7 @@ static struct lprocfs_seq_vars lprocfs_lod_osd_vars[] = { { "kbytesavail", &lod_dt_kbytesavail_fops }, { "filestotal", &lod_dt_filestotal_fops }, { "filesfree", &lod_dt_filesfree_fops }, - { 0 } + { NULL } }; static const struct file_operations lod_proc_target_fops = { diff --git a/lustre/lov/lov_dev.c b/lustre/lov/lov_dev.c index 17372b1..0c8c8d3 100644 --- a/lustre/lov/lov_dev.c +++ b/lustre/lov/lov_dev.c @@ -455,7 +455,7 @@ static int lov_process_config(const struct lu_env *env, case LCFG_LOV_ADD_INA: rc = lov_cl_add_target(env, d, index); if (rc != 0) - lov_del_target(d->ld_obd, index, 0, 0); + lov_del_target(d->ld_obd, index, NULL, 0); break; case LCFG_LOV_DEL_OBD: lov_cl_del_target(env, d, index); diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c index bc7dabe..6386d00 100644 --- a/lustre/lov/lov_obd.c +++ b/lustre/lov/lov_obd.c @@ -344,7 +344,7 @@ static int lov_disconnect(struct obd_export *exp) for (i = 0; i < lov->desc.ld_tgt_count; i++) { if (lov->lov_tgts[i] && lov->lov_tgts[i]->ltd_exp) { /* Disconnection is the last we know about an obd */ - lov_del_target(obd, i, 0, lov->lov_tgts[i]->ltd_gen); + lov_del_target(obd, i, NULL, lov->lov_tgts[i]->ltd_gen); } } obd_putref(obd); @@ -656,7 +656,7 @@ out: if (rc) { CERROR("add failed (%d), deleting %s\n", rc, obd_uuid2str(&tgt->ltd_uuid)); - lov_del_target(obd, index, 0, 0); + lov_del_target(obd, index, NULL, 0); } obd_putref(obd); RETURN(rc); @@ -944,7 +944,7 @@ static int lov_cleanup(struct obd_device *obd) "deathrow=%d, lovrc=%d\n", obd->obd_name, i, lov->lov_death_row, atomic_read(&lov->lov_refcount)); - lov_del_target(obd, i, 0, 0); + lov_del_target(obd, i, NULL, 0); } obd_putref(obd); OBD_FREE(lov->lov_tgts, sizeof(*lov->lov_tgts) * diff --git a/lustre/lov/lov_request.c b/lustre/lov/lov_request.c index 6100598..6867fa3 100644 --- a/lustre/lov/lov_request.c +++ b/lustre/lov/lov_request.c @@ -49,7 +49,7 @@ static void lov_init_set(struct lov_request_set *set) atomic_set(&set->set_completes, 0); atomic_set(&set->set_success, 0); atomic_set(&set->set_finish_checked, 0); - set->set_cookies = 0; + set->set_cookies = NULL; INIT_LIST_HEAD(&set->set_list); atomic_set(&set->set_refcount, 1); init_waitqueue_head(&set->set_waitq); diff --git a/lustre/lov/lproc_lov.c b/lustre/lov/lproc_lov.c index 1a1de46..d785880 100644 --- a/lustre/lov/lproc_lov.c +++ b/lustre/lov/lproc_lov.c @@ -298,7 +298,7 @@ struct lprocfs_seq_vars lprocfs_lov_obd_vars[] = { .fops = &lov_kbytesavail_fops }, { .name = "desc_uuid", .fops = &lov_desc_uuid_fops }, - { 0 } + { NULL } }; struct file_operations lov_proc_target_fops = { diff --git a/lustre/mdc/lproc_mdc.c b/lustre/mdc/lproc_mdc.c index 8bf0da3..3eaf776 100644 --- a/lustre/mdc/lproc_mdc.c +++ b/lustre/mdc/lproc_mdc.c @@ -142,6 +142,6 @@ struct lprocfs_seq_vars lprocfs_mdc_obd_vars[] = { .fops = &mdc_state_fops }, { .name = "pinger_recov", .fops = &mdc_pinger_recov_fops }, - { 0 } + { NULL } }; #endif /* LPROCFS */ diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index 06e209c..51794b1 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -1097,7 +1097,7 @@ int mdd_links_read(const struct lu_env *env, struct mdd_object *mdd_obj, struct lu_buf *mdd_links_get(const struct lu_env *env, struct mdd_object *mdd_obj) { - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; int rc; rc = mdd_links_read(env, mdd_obj, &ldata); @@ -2977,7 +2977,7 @@ static int mdd_linkea_update_child_internal(const struct lu_env *env, bool declare) { struct mdd_thread_info *info = mdd_env_info(env); - struct linkea_data ldata = {0}; + struct linkea_data ldata = { NULL }; struct lu_buf *buf = &info->mti_link_buf; int count; int rc = 0; @@ -3353,8 +3353,8 @@ static int mdd_migrate_create(const struct lu_env *env, struct mdd_thread_info *info = mdd_env_info(env); struct mdd_device *mdd = mdo2mdd(&mdd_sobj->mod_obj); struct md_op_spec *spec = &info->mti_spec; - struct lu_buf lmm_buf = { 0 }; - struct lu_buf link_buf = { 0 }; + struct lu_buf lmm_buf = { NULL }; + struct lu_buf link_buf = { NULL }; const struct lu_buf *buf; struct thandle *handle; struct lmv_mds_md_v1 *mgr_ea; diff --git a/lustre/mdd/mdd_lproc.c b/lustre/mdd/mdd_lproc.c index f4fa19b..b7241f4 100644 --- a/lustre/mdd/mdd_lproc.c +++ b/lustre/mdd/mdd_lproc.c @@ -293,7 +293,7 @@ static struct lprocfs_seq_vars lprocfs_mdd_obd_vars[] = { .fops = &mdd_lfsck_namespace_fops }, { .name = "lfsck_layout", .fops = &mdd_lfsck_layout_fops }, - { 0 } + { NULL } }; int mdd_procfs_init(struct mdd_device *mdd, const char *name) diff --git a/lustre/mdt/mdt_coordinator.c b/lustre/mdt/mdt_coordinator.c index 63d9582..2a6bb0e 100644 --- a/lustre/mdt/mdt_coordinator.c +++ b/lustre/mdt/mdt_coordinator.c @@ -449,7 +449,7 @@ static int mdt_coordinator(void *data) struct mdt_thread_info *mti = data; struct mdt_device *mdt = mti->mti_mdt; struct coordinator *cdt = &mdt->mdt_coordinator; - struct hsm_scan_data hsd = { 0 }; + struct hsm_scan_data hsd = { NULL }; int rc = 0; ENTRY; diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 5118c44..09cb211 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -5367,7 +5367,7 @@ static int mdt_path_current(struct mdt_thread_info *info, struct lu_buf *buf = &info->mti_big_buf; char *ptr; int reclen; - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; int rc = 0; bool first = true; ENTRY; diff --git a/lustre/mdt/mdt_lproc.c b/lustre/mdt/mdt_lproc.c index c7295cb..e922179 100644 --- a/lustre/mdt/mdt_lproc.c +++ b/lustre/mdt/mdt_lproc.c @@ -878,7 +878,7 @@ static struct lprocfs_seq_vars lprocfs_mdt_obd_vars[] = { .fops = &mdt_enable_remote_dir_gid_fops }, { .name = "hsm_control", .fops = &mdt_hsm_cdt_control_fops }, - { 0 } + { NULL } }; static int lprocfs_mdt_print_open_files(cfs_hash_t *hs, cfs_hash_bd_t *bd, diff --git a/lustre/mdt/mdt_mds.c b/lustre/mdt/mdt_mds.c index cb28d88..d0b0b29 100644 --- a/lustre/mdt/mdt_mds.c +++ b/lustre/mdt/mdt_mds.c @@ -468,7 +468,7 @@ LPROC_SEQ_FOPS_RO_TYPE(mds, uuid); static struct lprocfs_seq_vars lprocfs_mds_obd_vars[] = { { "uuid", &mds_uuid_fops }, - { 0 } + { NULL } }; static struct lu_device *mds_device_alloc(const struct lu_env *env, diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index 62538bc..aa17d09 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -1369,7 +1369,7 @@ static int mdt_lock_objects_in_linkea(struct mdt_thread_info *info, struct list_head *lock_list) { struct lu_buf *buf = &info->mti_big_buf; - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; int count; int rc; ENTRY; diff --git a/lustre/mgc/lproc_mgc.c b/lustre/mgc/lproc_mgc.c index f818def..5de4f17 100644 --- a/lustre/mgc/lproc_mgc.c +++ b/lustre/mgc/lproc_mgc.c @@ -76,6 +76,6 @@ struct lprocfs_seq_vars lprocfs_mgc_obd_vars[] = { .fops = &mgc_state_fops }, { .name = "ir_state", .fops = &mgc_ir_state_fops }, - { 0 } + { NULL } }; #endif /* LPROCFS */ diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index 9c3ea33..c662b86 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -205,7 +205,7 @@ struct config_llog_data *do_config_log_add(struct obd_device *obd, ENTRY; CDEBUG(D_MGC, "do adding config log %s:%p\n", logname, - cfg ? cfg->cfg_instance : 0); + cfg ? cfg->cfg_instance : NULL); OBD_ALLOC(cld, sizeof(*cld) + strlen(logname) + 1); if (!cld) diff --git a/lustre/mgs/lproc_mgs.c b/lustre/mgs/lproc_mgs.c index 2d86d35..ae4cc39 100644 --- a/lustre/mgs/lproc_mgs.c +++ b/lustre/mgs/lproc_mgs.c @@ -218,7 +218,7 @@ static struct lprocfs_seq_vars lprocfs_mgs_obd_vars[] = { .fops = &mgs_evict_client_fops }, { .name = "ir_timeout", .fops = &mgs_ir_timeout_fops }, - { 0 } + { NULL } }; int lproc_mgs_setup(struct mgs_device *mgs, const char *osd_name) diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index 85a42a9..361aaa6 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -824,21 +824,24 @@ static inline int record_add_uuid(const struct lu_env *env, struct llog_handle *llh, uint64_t nid, char *uuid) { - return record_base(env, llh, NULL, nid, LCFG_ADD_UUID, uuid, 0, 0, 0); + return record_base(env, llh, NULL, nid, LCFG_ADD_UUID, uuid, + NULL, NULL, NULL); } static inline int record_add_conn(const struct lu_env *env, struct llog_handle *llh, char *devname, char *uuid) { - return record_base(env, llh, devname, 0, LCFG_ADD_CONN, uuid, 0, 0, 0); + return record_base(env, llh, devname, 0, LCFG_ADD_CONN, uuid, + NULL, NULL, NULL); } static inline int record_attach(const struct lu_env *env, struct llog_handle *llh, char *devname, char *type, char *uuid) { - return record_base(env, llh,devname, 0, LCFG_ATTACH, type, uuid, 0, 0); + return record_base(env, llh, devname, 0, LCFG_ATTACH, type, uuid, + NULL, NULL); } static inline int record_setup(const struct lu_env *env, @@ -1316,8 +1319,8 @@ static inline int record_lov_add(const struct lu_env *env, char *lov_name, char *ost_uuid, char *index, char *gen) { - return record_base(env,llh,lov_name,0,LCFG_LOV_ADD_OBD, - ost_uuid, index, gen, 0); + return record_base(env, llh, lov_name, 0, LCFG_LOV_ADD_OBD, + ost_uuid, index, gen, NULL); } static inline int record_mount_opt(const struct lu_env *env, @@ -1325,8 +1328,8 @@ static inline int record_mount_opt(const struct lu_env *env, char *profile, char *lov_name, char *mdc_name) { - return record_base(env,llh,NULL,0,LCFG_MOUNTOPT, - profile,lov_name,mdc_name,0); + return record_base(env, llh, NULL, 0, LCFG_MOUNTOPT, + profile, lov_name, mdc_name, NULL); } static int record_marker(const struct lu_env *env, @@ -1984,7 +1987,8 @@ static int mgs_write_log_mdc_to_lmv(const struct lu_env *env, rc = record_attach(env, llh, mdcname, LUSTRE_MDC_NAME, lmvuuid); if (rc) GOTO(out_end, rc); - rc = record_setup(env, llh, mdcname, mti->mti_uuid, nodeuuid, 0, 0); + rc = record_setup(env, llh, mdcname, mti->mti_uuid, nodeuuid, + NULL, NULL); if (rc) GOTO(out_end, rc); rc = mgs_write_log_failnids(env, mti, llh, mdcname); @@ -2418,7 +2422,8 @@ static int mgs_write_log_osc_to_lov(const struct lu_env *env, rc = record_attach(env, llh, oscname, LUSTRE_OSC_NAME, lovuuid); if (rc) GOTO(out_end, rc); - rc = record_setup(env, llh, oscname, mti->mti_uuid, nodeuuid, 0, 0); + rc = record_setup(env, llh, oscname, mti->mti_uuid, nodeuuid, + NULL, NULL); if (rc) GOTO(out_end, rc); rc = mgs_write_log_failnids(env, mti, llh, oscname); @@ -2492,7 +2497,7 @@ static int mgs_write_log_ost(const struct lu_env *env, GOTO(out_end, rc); rc = record_setup(env, llh, mti->mti_svname, "dev"/*ignored*/, "type"/*ignored*/, - failout ? "n" : "f", 0/*options*/); + failout ? "n" : "f", NULL/*options*/); if (rc) GOTO(out_end, rc); rc = record_marker(env, llh, fsdb, CM_END, mti->mti_svname, "add ost"); @@ -3965,7 +3970,7 @@ static int mgs_write_log_pool(const struct lu_env *env, if (rc) goto out; rc = record_base(env, llh, tgtname, 0, cmd, - fsname, poolname, ostname, 0); + fsname, poolname, ostname, NULL); if (rc) goto out; rc = record_marker(env, llh, fsdb, CM_END, tgtname, comment); diff --git a/lustre/obdclass/linux/linux-module.c b/lustre/obdclass/linux/linux-module.c index 76ef057..3b574b7 100644 --- a/lustre/obdclass/linux/linux-module.c +++ b/lustre/obdclass/linux/linux-module.c @@ -322,7 +322,7 @@ static struct lprocfs_seq_vars lprocfs_base[] = { .fops = &obd_proc_health_fops }, { .name = "jobid_var", .fops = &obd_proc_jobid_var_fops}, - { 0 } + { NULL } }; #else #define lprocfs_base NULL diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index 317d401..a27ad4e 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -183,7 +183,7 @@ EXPORT_SYMBOL(class_get_next_param); /* returns 0 if this is the first key in the buffer, else 1. valp points to first char after key. */ -int class_match_param(char *buf, char *key, char **valp) +int class_match_param(char *buf, const char *key, char **valp) { if (!buf) return 1; @@ -1162,7 +1162,7 @@ int class_process_config(struct lustre_cfg *lcfg) char *tmp; /* llite has no obd */ if ((class_match_param(lustre_cfg_string(lcfg, 1), - PARAM_LLITE, 0) == 0) && + PARAM_LLITE, NULL) == 0) && client_process_config) { err = (*client_process_config)(lcfg); GOTO(out, err); @@ -1304,7 +1304,7 @@ int class_process_proc_param(char *prefix, struct lprocfs_seq_vars *lvars, /* Search proc entries */ while (lvars[j].name) { var = &lvars[j]; - if (class_match_param(key, (char *)var->name, 0) == 0 && + if (class_match_param(key, var->name, NULL) == 0 && keylen == strlen(var->name)) { matched++; rc = -EROFS; diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index 0ae9886..24cd79c 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -194,7 +194,7 @@ int lustre_start_simple(char *obdname, char *type, char *uuid, int rc; CDEBUG(D_MOUNT, "Starting obd %s (typ=%s)\n", obdname, type); - rc = do_lcfg(obdname, 0, LCFG_ATTACH, type, uuid, 0, 0); + rc = do_lcfg(obdname, 0, LCFG_ATTACH, type, uuid, NULL, NULL); if (rc) { CERROR("%s attach error %d\n", obdname, rc); return rc; @@ -202,7 +202,7 @@ int lustre_start_simple(char *obdname, char *type, char *uuid, rc = do_lcfg(obdname, 0, LCFG_SETUP, s1, s2, s3, s4); if (rc) { CERROR("%s setup error %d\n", obdname, rc); - do_lcfg(obdname, 0, LCFG_DETACH, 0, 0, 0, 0); + do_lcfg(obdname, 0, LCFG_DETACH, NULL, NULL, NULL, NULL); } return rc; } @@ -347,7 +347,7 @@ int lustre_start_mgc(struct super_block *sb) lnet_process_id_t id; while ((rc = LNetGetId(i++, &id)) != -ENOENT) { rc = do_lcfg(mgcname, id.nid, LCFG_ADD_UUID, - niduuid, 0, 0, 0); + niduuid, NULL, NULL, NULL); } } else { /* Use mgsnode= nids */ @@ -368,7 +368,7 @@ int lustre_start_mgc(struct super_block *sb) */ while (class_parse_nid(ptr, &nid, &ptr) == 0) { rc = do_lcfg(mgcname, nid, LCFG_ADD_UUID, - niduuid, 0, 0, 0); + niduuid, NULL, NULL, NULL); if (rc == 0) { i = 1; break; @@ -380,7 +380,7 @@ int lustre_start_mgc(struct super_block *sb) ptr = lsi->lsi_lmd->lmd_dev; while (class_parse_nid(ptr, &nid, &ptr) == 0) { rc = do_lcfg(mgcname, nid, LCFG_ADD_UUID, - niduuid, 0, 0, 0); + niduuid, NULL, NULL, NULL); if (rc == 0) ++i; /* Stop at the first failover nid */ @@ -402,7 +402,7 @@ int lustre_start_mgc(struct super_block *sb) /* Start the MGC */ rc = lustre_start_simple(mgcname, LUSTRE_MGC_NAME, (char *)uuid->uuid, LUSTRE_MGS_OBDNAME, - niduuid, 0, 0); + niduuid, NULL, NULL); OBD_FREE_PTR(uuid); if (rc) GOTO(out_free, rc); @@ -416,7 +416,7 @@ int lustre_start_mgc(struct super_block *sb) j = 0; while (class_parse_nid_quiet(ptr, &nid, &ptr) == 0) { rc = do_lcfg(mgcname, nid, LCFG_ADD_UUID, - niduuid, 0, 0, 0); + niduuid, NULL, NULL, NULL); if (rc == 0) ++j; if (*ptr == ':') @@ -424,7 +424,7 @@ int lustre_start_mgc(struct super_block *sb) } if (j > 0) { rc = do_lcfg(mgcname, 0, LCFG_ADD_CONN, - niduuid, 0, 0, 0); + niduuid, NULL, NULL, NULL); if (rc == 0) ++i; } else { @@ -491,7 +491,7 @@ static int lustre_stop_mgc(struct super_block *sb) { struct lustre_sb_info *lsi = s2lsi(sb); struct obd_device *obd; - char *niduuid = 0, *ptr = 0; + char *niduuid = NULL, *ptr = NULL; int i, rc = 0, len = 0; ENTRY; @@ -544,7 +544,7 @@ static int lustre_stop_mgc(struct super_block *sb) for (i = 0; i < lsi->lsi_lmd->lmd_mgs_failnodes; i++) { sprintf(ptr, "_%x", i); rc = do_lcfg(LUSTRE_MGC_OBDNAME, 0, LCFG_DEL_UUID, - niduuid, 0, 0, 0); + niduuid, NULL, NULL, NULL); if (rc) CERROR("del MDC UUID %s failed: rc = %d\n", niduuid, rc); diff --git a/lustre/obdclass/obd_mount_server.c b/lustre/obdclass/obd_mount_server.c index 148cbf3..a669f56 100644 --- a/lustre/obdclass/obd_mount_server.c +++ b/lustre/obdclass/obd_mount_server.c @@ -241,8 +241,8 @@ static int server_start_mgs(struct super_block *sb) if (!rc) { rc = lustre_start_simple(LUSTRE_MGS_OBDNAME, LUSTRE_MGS_NAME, - LUSTRE_MGS_OBDNAME, 0, 0, - lsi->lsi_osd_obdname, 0); + LUSTRE_MGS_OBDNAME, NULL, NULL, + lsi->lsi_osd_obdname, NULL); /* server_deregister_mount() is not called previously, for lsi * and other stuff can't be freed cleanly when mgs calls * server_put_mount() in error handling case (see b=17758), @@ -609,7 +609,7 @@ static int lustre_lwp_setup(struct lustre_cfg *lcfg, struct lustre_sb_info *lsi, sprintf(lwpuuid, "%s_UUID", lwpname); rc = lustre_start_simple(lwpname, LUSTRE_LWP_NAME, lwpuuid, lustre_cfg_string(lcfg, 1), - 0, 0, 0); + NULL, NULL, NULL); if (rc) { CERROR("%s: setup up failed: rc %d\n", lwpname, rc); GOTO(out, rc); @@ -1245,7 +1245,7 @@ static int server_start_targets(struct super_block *sb) rc = lustre_start_simple(LUSTRE_MDS_OBDNAME, LUSTRE_MDS_NAME, LUSTRE_MDS_OBDNAME"_uuid", - 0, 0, 0, 0); + NULL, NULL, NULL, NULL); if (rc) { mutex_unlock(&server_start_lock); CERROR("failed to start MDS: %d\n", rc); @@ -1264,7 +1264,7 @@ static int server_start_targets(struct super_block *sb) rc = lustre_start_simple(LUSTRE_OSS_OBDNAME, LUSTRE_OSS_NAME, LUSTRE_OSS_OBDNAME"_uuid", - 0, 0, 0, 0); + NULL, NULL, NULL, NULL); if (rc) { mutex_unlock(&server_start_lock); CERROR("failed to start OSS: %d\n", rc); @@ -1630,7 +1630,7 @@ static const struct inode_operations server_inode_operations = { static int server_fill_super_common(struct super_block *sb) { - struct inode *root = 0; + struct inode *root = NULL; ENTRY; CDEBUG(D_MOUNT, "Server sb, dev=%d\n", (int)sb->s_dev); diff --git a/lustre/obdecho/echo.c b/lustre/obdecho/echo.c index a57b94bb..af58063 100644 --- a/lustre/obdecho/echo.c +++ b/lustre/obdecho/echo.c @@ -561,7 +561,7 @@ LPROC_SEQ_FOPS_RO_TYPE(echo, uuid); static struct lprocfs_seq_vars lprocfs_echo_obd_vars[] = { { .name = "uuid", .fops = &echo_uuid_fops }, - { 0 } + { NULL } }; static int echo_setup(struct obd_device *obd, struct lustre_cfg *lcfg) diff --git a/lustre/ofd/lproc_ofd.c b/lustre/ofd/lproc_ofd.c index 46466a8..b3b0bfa 100644 --- a/lustre/ofd/lproc_ofd.c +++ b/lustre/ofd/lproc_ofd.c @@ -1056,7 +1056,7 @@ struct lprocfs_seq_vars lprocfs_ofd_obd_vars[] = { .fops = &ofd_lfsck_layout_fops }, { .name = "lfsck_verify_pfid", .fops = &ofd_lfsck_verify_pfid_fops }, - { 0 } + { NULL } }; /** diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index 7d7387a..403a35f 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -2867,7 +2867,7 @@ err_fini_fs: err_fini_lut: tgt_fini(env, &m->ofd_lut); err_free_ns: - ldlm_namespace_free(m->ofd_namespace, 0, obd->obd_force); + ldlm_namespace_free(m->ofd_namespace, NULL, obd->obd_force); obd->obd_namespace = m->ofd_namespace = NULL; err_fini_stack: ofd_stack_fini(env, m, &m->ofd_osd->dd_lu_dev); diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c index 84c8f80..a215cf1 100644 --- a/lustre/osc/lproc_osc.c +++ b/lustre/osc/lproc_osc.c @@ -635,7 +635,7 @@ struct lprocfs_seq_vars lprocfs_osc_obd_vars[] = { .fops = &osc_pinger_recov_fops }, { .name = "unstable_stats", .fops = &osc_unstable_stats_fops }, - { 0 } + { NULL } }; #define pct(a,b) (b ? a * 100 / b : 0) diff --git a/lustre/osc/osc_dev.c b/lustre/osc/osc_dev.c index 85e96ec..6ba193b 100644 --- a/lustre/osc/osc_dev.c +++ b/lustre/osc/osc_dev.c @@ -194,7 +194,7 @@ static int osc_device_init(const struct lu_env *env, struct lu_device *d, static struct lu_device *osc_device_fini(const struct lu_env *env, struct lu_device *d) { - return 0; + return NULL; } static struct lu_device *osc_device_free(const struct lu_env *env, diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 3f8afd6..46affb5 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -4234,7 +4234,7 @@ static int osd_get_pfid_from_linkea(const struct lu_env *env, struct lu_buf *buf = &oti->oti_big_buf; struct dentry *dentry = &oti->oti_obj_dentry; struct inode *inode = obj->oo_inode; - struct linkea_data ldata = { 0 }; + struct linkea_data ldata = { NULL }; int rc; ENTRY; diff --git a/lustre/osd-ldiskfs/osd_iam.c b/lustre/osd-ldiskfs/osd_iam.c index bac0084b..7c0e1f1 100644 --- a/lustre/osd-ldiskfs/osd_iam.c +++ b/lustre/osd-ldiskfs/osd_iam.c @@ -1412,7 +1412,7 @@ static void iam_unlock_array(struct iam_container *ic, int iam_index_next(struct iam_container *c, struct iam_path *path) { iam_ptr_t cursor; - struct dynlock_handle *lh[DX_MAX_TREE_HEIGHT] = { 0, }; + struct dynlock_handle *lh[DX_MAX_TREE_HEIGHT] = { NULL, }; int result; struct inode *object; @@ -1893,8 +1893,8 @@ int split_index_node(handle_t *handle, struct iam_path *path, struct iam_entry *entries; /* old block contents */ struct iam_entry *entries2; /* new block contents */ - struct iam_frame *frame, *safe; - struct buffer_head *bh_new[DX_MAX_TREE_HEIGHT] = {0}; + struct iam_frame *frame, *safe; + struct buffer_head *bh_new[DX_MAX_TREE_HEIGHT] = {NULL}; u32 newblock[DX_MAX_TREE_HEIGHT] = {0}; struct dynlock_handle *lock[DX_MAX_TREE_HEIGHT] = {NULL,}; struct dynlock_handle *new_lock[DX_MAX_TREE_HEIGHT] = {NULL,}; diff --git a/lustre/osd-ldiskfs/osd_iam_lvar.c b/lustre/osd-ldiskfs/osd_iam_lvar.c index 07fa84b..9ca1930 100644 --- a/lustre/osd-ldiskfs/osd_iam_lvar.c +++ b/lustre/osd-ldiskfs/osd_iam_lvar.c @@ -200,14 +200,14 @@ static __u32 hash_build0(const char *name, int namelen) struct ldiskfs_dx_hash_info hinfo; hinfo.hash_version = LDISKFS_DX_HASH_TEA; - hinfo.seed = 0; + hinfo.seed = NULL; ldiskfsfs_dirhash(name, namelen, &hinfo); result = hinfo.hash; if (LVAR_HASH_SANDWICH) { __u32 result2; hinfo.hash_version = LDISKFS_DX_HASH_TEA; - hinfo.seed = 0; + hinfo.seed = NULL; ldiskfsfs_dirhash(name, namelen, &hinfo); result2 = hinfo.hash; result = (0xfc000000 & result2) | (0x03ffffff & result); diff --git a/lustre/osd-ldiskfs/osd_lproc.c b/lustre/osd-ldiskfs/osd_lproc.c index 6c4d47d..32ef15f 100644 --- a/lustre/osd-ldiskfs/osd_lproc.c +++ b/lustre/osd-ldiskfs/osd_lproc.c @@ -625,13 +625,13 @@ struct lprocfs_seq_vars lprocfs_osd_obd_vars[] = { .fops = &ldiskfs_osd_readcache_fops }, { .name = "lma_self_repair", .fops = &ldiskfs_osd_lma_self_repair_fops }, - { 0 } + { NULL } }; struct lprocfs_seq_vars lprocfs_osd_module_vars[] = { { .name = "track_declares_assert", .fops = &ldiskfs_osd_track_declares_assert_fops }, - { 0 } + { NULL } }; diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c index 6f9e04a..c95046d 100644 --- a/lustre/osd-ldiskfs/osd_scrub.c +++ b/lustre/osd-ldiskfs/osd_scrub.c @@ -1230,7 +1230,7 @@ static int osd_inode_iteration(struct osd_thread_info *info, osd_iit_exec_policy exec; __u32 *pos; __u32 *count; - struct osd_iit_param param = { 0 }; + struct osd_iit_param param = { NULL }; struct l_wait_info lwi = { 0 }; __u32 limit; int rc; @@ -2356,13 +2356,13 @@ int osd_scrub_setup(const struct lu_env *env, struct osd_device *dev) lu_igif_build(fid, inode->i_ino, inode->i_generation); rc = osd_ea_fid_set(info, inode, fid, LMAC_NOT_IN_OI, 0); if (rc != 0) { - filp_close(filp, 0); + filp_close(filp, NULL); pop_ctxt(&saved, ctxt); RETURN(rc); } scrub->os_inode = igrab(inode); - filp_close(filp, 0); + filp_close(filp, NULL); pop_ctxt(&saved, ctxt); rc = osd_scrub_file_load(scrub); diff --git a/lustre/osp/lproc_osp.c b/lustre/osp/lproc_osp.c index 1dd26b7..2af2a1a 100644 --- a/lustre/osp/lproc_osp.c +++ b/lustre/osp/lproc_osp.c @@ -773,7 +773,7 @@ static struct lprocfs_seq_vars lprocfs_osp_obd_vars[] = { .fops = &osp_destroys_in_flight_fops }, { .name = "lfsck_max_rpcs_in_flight", .fops = &osp_lfsck_max_rpcs_in_flight_fops }, - { 0 } + { NULL } }; LPROC_SEQ_FOPS_RO_TYPE(osp, dt_blksize); @@ -796,7 +796,7 @@ static struct lprocfs_seq_vars lprocfs_osp_osd_vars[] = { .fops = &osp_dt_filestotal_fops }, { .name = "filesfree", .fops = &osp_dt_filesfree_fops }, - { 0 } + { NULL } }; /** diff --git a/lustre/ost/ost_handler.c b/lustre/ost/ost_handler.c index d9c4411..5e57e61 100644 --- a/lustre/ost/ost_handler.c +++ b/lustre/ost/ost_handler.c @@ -77,7 +77,7 @@ LPROC_SEQ_FOPS_RO_TYPE(ost, uuid); static struct lprocfs_seq_vars lprocfs_ost_obd_vars[] = { { .name = "uuid", .fops = &ost_uuid_fops }, - { 0 } + { NULL } }; #endif /* LPROCFS */ diff --git a/lustre/ptlrpc/gss/gss_keyring.c b/lustre/ptlrpc/gss/gss_keyring.c index 49bbae8..2803721 100644 --- a/lustre/ptlrpc/gss/gss_keyring.c +++ b/lustre/ptlrpc/gss/gss_keyring.c @@ -1226,7 +1226,7 @@ int gss_kt_instantiate(struct key *key, const void *data, size_t datalen) RETURN(-EINVAL); } - if (key->payload.data != 0) { + if (key->payload.data != NULL) { CERROR("key already have payload\n"); RETURN(-EINVAL); } diff --git a/lustre/ptlrpc/gss/gss_mech_switch.c b/lustre/ptlrpc/gss/gss_mech_switch.c index 1d80a77..ed0f251 100644 --- a/lustre/ptlrpc/gss/gss_mech_switch.c +++ b/lustre/ptlrpc/gss/gss_mech_switch.c @@ -331,7 +331,7 @@ __u32 lgss_delete_sec_context(struct gss_ctx **context_handle) return(GSS_S_NO_CONTEXT); mech = (*context_handle)->mech_type; - if ((*context_handle)->internal_ctx_id != 0) { + if ((*context_handle)->internal_ctx_id != NULL) { LASSERT(mech); LASSERT(mech->gm_ops); LASSERT(mech->gm_ops->gss_delete_sec_context); diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index f931461..a48dbe2 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -688,7 +688,7 @@ int ptlrpc_connect_import(struct obd_import *imp) if (rc) GOTO(out, rc); - rc = sptlrpc_import_sec_adapt(imp, NULL, 0); + rc = sptlrpc_import_sec_adapt(imp, NULL, NULL); if (rc) GOTO(out, rc); diff --git a/lustre/ptlrpc/sec.c b/lustre/ptlrpc/sec.c index 2196d19..a3d6c65 100644 --- a/lustre/ptlrpc/sec.c +++ b/lustre/ptlrpc/sec.c @@ -366,7 +366,7 @@ static int import_sec_check_expire(struct obd_import *imp) return 0; CDEBUG(D_SEC, "found delayed sec adapt expired, do it now\n"); - return sptlrpc_import_sec_adapt(imp, NULL, 0); + return sptlrpc_import_sec_adapt(imp, NULL, NULL); } /** diff --git a/lustre/quota/qsd_handler.c b/lustre/quota/qsd_handler.c index f919937..16f274c 100644 --- a/lustre/quota/qsd_handler.c +++ b/lustre/quota/qsd_handler.c @@ -385,7 +385,7 @@ static void qsd_req_completion(const struct lu_env *env, } /* extract information from lvb */ - if (ret == 0 && lvb != 0) { + if (ret == 0 && lvb != NULL) { if (lvb->lvb_id_qunit != 0) qsd_set_qunit(lqe, lvb->lvb_id_qunit); qsd_set_edquot(lqe, !!(lvb->lvb_flags & LQUOTA_FL_EDQUOT)); -- 1.8.3.1