The return value of snprintf() is the number of bytes that would have
been copies into the buffer if it was large enough.
Many places in the code use it as though it were the number of bytes
actually copied. In practice this (almost?) never makes a difference.
However it is poor style to use the wrong interfaces as it might one
day be copied to somewhere that it does make a difference.
So change these instances of snprintf to scnprintf which DOES return
the number of bytes actually copied.
This is all places where the return value is simply returned to the
call, and a couple of others.
Also change the declared buffer size in a couple of places to the
actual buffer size (PAGE_SIZE in these cases).
Test-Parameters: trivial
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I5428760689eaca98e6bf2bceae119f1b7acf35ac
Reviewed-on: https://review.whamcloud.com/39744
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
15 files changed:
struct netstrfns *nf = nr->nr_netstrfns;
if (nr->nr_netnum == 0)
struct netstrfns *nf = nr->nr_netstrfns;
if (nr->nr_netnum == 0)
- return snprintf(buffer, count, "@%s", nf->nf_name);
+ return scnprintf(buffer, count, "@%s", nf->nf_name);
- return snprintf(buffer, count, "@%s%u",
- nf->nf_name, nr->nr_netnum);
+ return scnprintf(buffer, count, "@%s%u",
+ nf->nf_name, nr->nr_netnum);
struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace,
ns_kobj);
struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace,
ns_kobj);
- return snprintf(buf, PAGE_SIZE, "%llu\n",
- ktime_divns(ns->ns_dirty_age_limit, NSEC_PER_SEC));
+ return scnprintf(buf, PAGE_SIZE, "%llu\n",
+ ktime_divns(ns->ns_dirty_age_limit, NSEC_PER_SEC));
}
static ssize_t dirty_age_limit_store(struct kobject *kobj,
}
static ssize_t dirty_age_limit_store(struct kobject *kobj,
struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace,
ns_kobj);
struct ldlm_namespace *ns = container_of(kobj, struct ldlm_namespace,
ns_kobj);
- return snprintf(buf, PAGE_SIZE, "%u\n", ns->ns_ctime_age_limit);
+ return scnprintf(buf, PAGE_SIZE, "%u\n", ns->ns_ctime_age_limit);
}
static ssize_t ctime_age_limit_store(struct kobject *kobj,
}
static ssize_t ctime_age_limit_store(struct kobject *kobj,
continue;
lnr->lnr_fid = *cfid;
continue;
lnr->lnr_fid = *cfid;
- lnr->lnr_namelen = snprintf(lnr->lnr_name,
- lnr->lnr_size - sizeof(*lnr),
- DFID":%u", PFID(cfid), i);
+ lnr->lnr_namelen = scnprintf(lnr->lnr_name,
+ lnr->lnr_size - sizeof(*lnr),
+ DFID":%u", PFID(cfid), i);
cname = lfsck_name_get_const(env, lnr->lnr_name,
lnr->lnr_namelen);
obj = lfsck_object_find_bottom(env, lfsck, cfid);
cname = lfsck_name_get_const(env, lnr->lnr_name,
lnr->lnr_namelen);
obj = lfsck_object_find_bottom(env, lfsck, cfid);
struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
ll_kset.kobj);
struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
ll_kset.kobj);
- return snprintf(buf, 16, "%u\n", sbi->ll_sa_running_max);
+ return scnprintf(buf, PAGE_SIZE, "%u\n", sbi->ll_sa_running_max);
}
static ssize_t statahead_running_max_store(struct kobject *kobj,
}
static ssize_t statahead_running_max_store(struct kobject *kobj,
struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
ll_kset.kobj);
struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
ll_kset.kobj);
- return snprintf(buf, PAGE_SIZE, "%u\n", sbi->ll_statfs_max_age);
+ return scnprintf(buf, PAGE_SIZE, "%u\n", sbi->ll_statfs_max_age);
}
static ssize_t statfs_max_age_store(struct kobject *kobj,
}
static ssize_t statfs_max_age_store(struct kobject *kobj,
return rc;
/* Limit xattr size returned to userspace based on kernel maximum */
return rc;
/* Limit xattr size returned to userspace based on kernel maximum */
- return snprintf(buf, PAGE_SIZE, "%u\n",
- ealen > XATTR_SIZE_MAX ? XATTR_SIZE_MAX : ealen);
+ return scnprintf(buf, PAGE_SIZE, "%u\n",
+ ealen > XATTR_SIZE_MAX ? XATTR_SIZE_MAX : ealen);
}
LUSTRE_RO_ATTR(max_easize);
}
LUSTRE_RO_ATTR(max_easize);
return rc;
/* Limit xattr size returned to userspace based on kernel maximum */
return rc;
/* Limit xattr size returned to userspace based on kernel maximum */
- return snprintf(buf, PAGE_SIZE, "%u\n",
- ealen > XATTR_SIZE_MAX ? XATTR_SIZE_MAX : ealen);
+ return scnprintf(buf, PAGE_SIZE, "%u\n",
+ ealen > XATTR_SIZE_MAX ? XATTR_SIZE_MAX : ealen);
struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
ll_kset.kobj);
struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
ll_kset.kobj);
- return snprintf(buf, PAGE_SIZE, "%u\n",
- sbi->ll_ra_info.ra_async_max_active);
+ return scnprintf(buf, PAGE_SIZE, "%u\n",
+ sbi->ll_ra_info.ra_async_max_active);
}
static ssize_t max_read_ahead_async_active_store(struct kobject *kobj,
}
static ssize_t max_read_ahead_async_active_store(struct kobject *kobj,
struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
ll_kset.kobj);
struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
ll_kset.kobj);
- return snprintf(buf, PAGE_SIZE, "%lu\n",
- PAGES_TO_MiB(sbi->ll_ra_info.ra_async_pages_per_file_threshold));
+ return scnprintf(buf, PAGE_SIZE, "%lu\n", PAGES_TO_MiB(
+ sbi->ll_ra_info.ra_async_pages_per_file_threshold));
struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
ll_kset.kobj);
struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
ll_kset.kobj);
- return snprintf(buf, PAGE_SIZE, "%u\n",
- !!(sbi->ll_flags & LL_SBI_FILE_HEAT));
+ return scnprintf(buf, PAGE_SIZE, "%u\n",
+ !!(sbi->ll_flags & LL_SBI_FILE_HEAT));
}
static ssize_t file_heat_store(struct kobject *kobj,
}
static ssize_t file_heat_store(struct kobject *kobj,
struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
ll_kset.kobj);
struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
ll_kset.kobj);
- return snprintf(buf, PAGE_SIZE, "%u\n",
- (sbi->ll_heat_decay_weight * 100 + 128) / 256);
+ return scnprintf(buf, PAGE_SIZE, "%u\n",
+ (sbi->ll_heat_decay_weight * 100 + 128) / 256);
}
static ssize_t heat_decay_percentage_store(struct kobject *kobj,
}
static ssize_t heat_decay_percentage_store(struct kobject *kobj,
struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
ll_kset.kobj);
struct ll_sb_info *sbi = container_of(kobj, struct ll_sb_info,
ll_kset.kobj);
- return snprintf(buf, PAGE_SIZE, "%u\n", sbi->ll_heat_period_second);
+ return scnprintf(buf, PAGE_SIZE, "%u\n", sbi->ll_heat_period_second);
}
static ssize_t heat_period_second_store(struct kobject *kobj,
}
static ssize_t heat_period_second_store(struct kobject *kobj,
#define MAX_PCC_DATABASE_PATH (6 * 5 + FID_NOBRACE_LEN + 1)
static int pcc_fid2dataset_path(char *buf, int sz, struct lu_fid *fid)
{
#define MAX_PCC_DATABASE_PATH (6 * 5 + FID_NOBRACE_LEN + 1)
static int pcc_fid2dataset_path(char *buf, int sz, struct lu_fid *fid)
{
- return snprintf(buf, sz, "%04x/%04x/%04x/%04x/%04x/%04x/"
- DFID_NOBRACE,
- (fid)->f_oid & 0xFFFF,
- (fid)->f_oid >> 16 & 0xFFFF,
- (unsigned int)((fid)->f_seq & 0xFFFF),
- (unsigned int)((fid)->f_seq >> 16 & 0xFFFF),
- (unsigned int)((fid)->f_seq >> 32 & 0xFFFF),
- (unsigned int)((fid)->f_seq >> 48 & 0xFFFF),
- PFID(fid));
+ return scnprintf(buf, sz, "%04x/%04x/%04x/%04x/%04x/%04x/"
+ DFID_NOBRACE,
+ (fid)->f_oid & 0xFFFF,
+ (fid)->f_oid >> 16 & 0xFFFF,
+ (unsigned int)((fid)->f_seq & 0xFFFF),
+ (unsigned int)((fid)->f_seq >> 16 & 0xFFFF),
+ (unsigned int)((fid)->f_seq >> 32 & 0xFFFF),
+ (unsigned int)((fid)->f_seq >> 48 & 0xFFFF),
+ PFID(fid));
}
static inline const struct cred *pcc_super_cred(struct super_block *sb)
}
static inline const struct cred *pcc_super_cred(struct super_block *sb)
static int pcc_fid2dataset_fullpath(char *buf, int sz, struct lu_fid *fid,
struct pcc_dataset *dataset)
{
static int pcc_fid2dataset_fullpath(char *buf, int sz, struct lu_fid *fid,
struct pcc_dataset *dataset)
{
- return snprintf(buf, sz, "%s/%04x/%04x/%04x/%04x/%04x/%04x/"
- DFID_NOBRACE,
- dataset->pccd_pathname,
- (fid)->f_oid & 0xFFFF,
- (fid)->f_oid >> 16 & 0xFFFF,
- (unsigned int)((fid)->f_seq & 0xFFFF),
- (unsigned int)((fid)->f_seq >> 16 & 0xFFFF),
- (unsigned int)((fid)->f_seq >> 32 & 0xFFFF),
- (unsigned int)((fid)->f_seq >> 48 & 0xFFFF),
- PFID(fid));
+ return scnprintf(buf, sz, "%s/%04x/%04x/%04x/%04x/%04x/%04x/"
+ DFID_NOBRACE,
+ dataset->pccd_pathname,
+ (fid)->f_oid & 0xFFFF,
+ (fid)->f_oid >> 16 & 0xFFFF,
+ (unsigned int)((fid)->f_seq & 0xFFFF),
+ (unsigned int)((fid)->f_seq >> 16 & 0xFFFF),
+ (unsigned int)((fid)->f_seq >> 32 & 0xFFFF),
+ (unsigned int)((fid)->f_seq >> 48 & 0xFFFF),
+ PFID(fid));
}
/* Must be called with pcci->pcci_lock held */
}
/* Must be called with pcci->pcci_lock held */
struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
struct lod_device *lod = dt2lod_dev(dt);
struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
struct lod_device *lod = dt2lod_dev(dt);
- return snprintf(buf, PAGE_SIZE, "%u\n",
- lod->lod_dom_stripesize_max_kb << 10);
+ return scnprintf(buf, PAGE_SIZE, "%u\n",
+ lod->lod_dom_stripesize_max_kb << 10);
}
static inline int dom_stripesize_max_kb_update(struct lod_device *lod,
}
static inline int dom_stripesize_max_kb_update(struct lod_device *lod,
struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
struct lod_device *lod = dt2lod_dev(dt);
struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
struct lod_device *lod = dt2lod_dev(dt);
- return snprintf(buf, PAGE_SIZE, "%u\n",
- lod->lod_dom_stripesize_max_kb);
+ return scnprintf(buf, PAGE_SIZE, "%u\n",
+ lod->lod_dom_stripesize_max_kb);
struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
struct lod_device *lod = dt2lod_dev(dt);
struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
struct lod_device *lod = dt2lod_dev(dt);
- return snprintf(buf, PAGE_SIZE, "%u\n", lod->lod_dom_stripesize_cur_kb);
+ return scnprintf(buf, PAGE_SIZE, "%u\n",
+ lod->lod_dom_stripesize_cur_kb);
}
LUSTRE_RO_ATTR(dom_stripesize_cur_kb);
}
LUSTRE_RO_ATTR(dom_stripesize_cur_kb);
struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
struct lod_device *lod = dt2lod_dev(dt);
struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
struct lod_device *lod = dt2lod_dev(dt);
- return snprintf(buf, PAGE_SIZE, "%llu\n",
- lod->lod_dom_threshold_free_mb);
+ return scnprintf(buf, PAGE_SIZE, "%llu\n",
+ lod->lod_dom_threshold_free_mb);
dd_kobj);
struct lod_device *lod = dt2lod_dev(dt);
dd_kobj);
struct lod_device *lod = dt2lod_dev(dt);
- return snprintf(buf, PAGE_SIZE, "%llu\n",
- lod->lod_ost_descs.ltd_lov_desc.ld_default_stripe_size);
+ return scnprintf(buf, PAGE_SIZE, "%llu\n",
+ lod->lod_ost_descs.ltd_lov_desc.ld_default_stripe_size);
}
static ssize_t stripesize_store(struct kobject *kobj, struct attribute *attr,
}
static ssize_t stripesize_store(struct kobject *kobj, struct attribute *attr,
dd_kobj);
struct lod_device *lod = dt2lod_dev(dt);
dd_kobj);
struct lod_device *lod = dt2lod_dev(dt);
- return snprintf(buf, PAGE_SIZE, "%lld\n",
+ return scnprintf(buf, PAGE_SIZE, "%lld\n",
lod->lod_ost_descs.ltd_lov_desc.ld_default_stripe_offset);
}
lod->lod_ost_descs.ltd_lov_desc.ld_default_stripe_offset);
}
struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
&lod->lod_ost_descs;
struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
&lod->lod_ost_descs;
- return snprintf(buf, PAGE_SIZE, "%u\n", ltd->ltd_lov_desc.ld_pattern);
+ return scnprintf(buf, PAGE_SIZE, "%u\n", ltd->ltd_lov_desc.ld_pattern);
}
static ssize_t mdt_stripetype_show(struct kobject *kobj, struct attribute *attr,
}
static ssize_t mdt_stripetype_show(struct kobject *kobj, struct attribute *attr,
struct lov_desc *desc = is_mdt ? &lod->lod_mdt_descs.ltd_lov_desc :
&lod->lod_ost_descs.ltd_lov_desc;
struct lov_desc *desc = is_mdt ? &lod->lod_mdt_descs.ltd_lov_desc :
&lod->lod_ost_descs.ltd_lov_desc;
- return snprintf(buf, PAGE_SIZE, "%d\n",
- (s16)(desc->ld_default_stripe_count + 1) - 1);
+ return scnprintf(buf, PAGE_SIZE, "%d\n",
+ (s16)(desc->ld_default_stripe_count + 1) - 1);
}
static ssize_t mdt_stripecount_show(struct kobject *kobj,
}
static ssize_t mdt_stripecount_show(struct kobject *kobj,
struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
&lod->lod_ost_descs;
struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
&lod->lod_ost_descs;
- return snprintf(buf, PAGE_SIZE, "%u\n", ltd->ltd_lov_desc.ld_tgt_count);
+ return scnprintf(buf, PAGE_SIZE, "%u\n",
+ ltd->ltd_lov_desc.ld_tgt_count);
}
static ssize_t mdt_numobd_show(struct kobject *kobj, struct attribute *attr,
}
static ssize_t mdt_numobd_show(struct kobject *kobj, struct attribute *attr,
struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
&lod->lod_ost_descs;
struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
&lod->lod_ost_descs;
- return snprintf(buf, PAGE_SIZE, "%u\n",
- ltd->ltd_lov_desc.ld_active_tgt_count);
+ return scnprintf(buf, PAGE_SIZE, "%u\n",
+ ltd->ltd_lov_desc.ld_active_tgt_count);
}
static ssize_t mdt_activeobd_show(struct kobject *kobj, struct attribute *attr,
}
static ssize_t mdt_activeobd_show(struct kobject *kobj, struct attribute *attr,
dd_kobj);
struct lod_device *lod = dt2lod_dev(dt);
dd_kobj);
struct lod_device *lod = dt2lod_dev(dt);
- return snprintf(buf, PAGE_SIZE, "%s\n",
- lod->lod_ost_descs.ltd_lov_desc.ld_uuid.uuid);
+ return scnprintf(buf, PAGE_SIZE, "%s\n",
+ lod->lod_ost_descs.ltd_lov_desc.ld_uuid.uuid);
}
LUSTRE_RO_ATTR(desc_uuid);
}
LUSTRE_RO_ATTR(desc_uuid);
struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
&lod->lod_ost_descs;
struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
&lod->lod_ost_descs;
- return snprintf(buf, PAGE_SIZE, "%d%%\n",
- (ltd->ltd_qos.lq_prio_free * 100 + 255) >> 8);
+ return scnprintf(buf, PAGE_SIZE, "%d%%\n",
+ (ltd->ltd_qos.lq_prio_free * 100 + 255) >> 8);
}
static ssize_t mdt_qos_prio_free_show(struct kobject *kobj,
}
static ssize_t mdt_qos_prio_free_show(struct kobject *kobj,
struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
&lod->lod_ost_descs;
struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
&lod->lod_ost_descs;
- return snprintf(buf, PAGE_SIZE, "%d%%\n",
- (ltd->ltd_qos.lq_threshold_rr * 100 + 255) >> 8);
+ return scnprintf(buf, PAGE_SIZE, "%d%%\n",
+ (ltd->ltd_qos.lq_threshold_rr * 100 + 255) >> 8);
}
static ssize_t mdt_qos_threshold_rr_show(struct kobject *kobj,
}
static ssize_t mdt_qos_threshold_rr_show(struct kobject *kobj,
struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
&lod->lod_ost_descs;
struct lu_tgt_descs *ltd = is_mdt ? &lod->lod_mdt_descs :
&lod->lod_ost_descs;
- return snprintf(buf, PAGE_SIZE, "%u Sec\n",
- ltd->ltd_lov_desc.ld_qos_maxage);
+ return scnprintf(buf, PAGE_SIZE, "%u Sec\n",
+ ltd->ltd_lov_desc.ld_qos_maxage);
}
static ssize_t mdt_qos_maxage_show(struct kobject *kobj, struct attribute *attr,
}
static ssize_t mdt_qos_maxage_show(struct kobject *kobj, struct attribute *attr,
dd_kobj);
struct lod_device *lod = dt2lod_dev(dt);
dd_kobj);
struct lod_device *lod = dt2lod_dev(dt);
- return snprintf(buf, PAGE_SIZE, "%d\n", lod->lod_lmv_failout ? 1 : 0);
+ return scnprintf(buf, PAGE_SIZE, "%d\n", lod->lod_lmv_failout ? 1 : 0);
struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
struct lod_device *lod = dt2lod_dev(dt);
struct dt_device *dt = container_of(kobj, struct dt_device, dd_kobj);
struct lod_device *lod = dt2lod_dev(dt);
- return snprintf(buf, PAGE_SIZE, "%s\n",
+ return scnprintf(buf, PAGE_SIZE, "%s\n",
mdt_hash_name[lod->lod_mdt_descs.ltd_lmv_desc.ld_pattern]);
}
mdt_hash_name[lod->lod_mdt_descs.ltd_lmv_desc.ld_pattern]);
}
struct mdd_device *mdd = container_of(kobj, struct mdd_device,
mdd_kobj);
struct mdd_device *mdd = container_of(kobj, struct mdd_device,
mdd_kobj);
- return snprintf(buf, PAGE_SIZE, "%d\n", mdd->mdd_append_stripe_count);
+ return scnprintf(buf, PAGE_SIZE, "%d\n", mdd->mdd_append_stripe_count);
struct mdd_device *mdd = container_of(kobj, struct mdd_device,
mdd_kobj);
struct mdd_device *mdd = container_of(kobj, struct mdd_device,
mdd_kobj);
- return snprintf(buf, LOV_MAXPOOLNAME + 1, "%s\n", mdd->mdd_append_pool);
+ return scnprintf(buf, PAGE_SIZE, "%s\n", mdd->mdd_append_pool);
int rc = 0;
if (strlen(obd_jobid_var))
int rc = 0;
if (strlen(obd_jobid_var))
- rc = snprintf(buf, PAGE_SIZE, "%s\n", obd_jobid_var);
+ rc = scnprintf(buf, PAGE_SIZE, "%s\n", obd_jobid_var);
int rc = 0;
if (strlen(obd_jobid_name))
int rc = 0;
if (strlen(obd_jobid_name))
- rc = snprintf(buf, PAGE_SIZE, "%s\n", obd_jobid_name);
+ rc = scnprintf(buf, PAGE_SIZE, "%s\n", obd_jobid_name);
rcu_read_lock();
jid = jobid_current();
if (jid)
rcu_read_lock();
jid = jobid_current();
if (jid)
- ret = snprintf(buf, PAGE_SIZE, "%s\n", jid);
+ ret = scnprintf(buf, PAGE_SIZE, "%s\n", jid);
rcu_read_unlock();
return ret;
}
rcu_read_unlock();
return ret;
}
obd_kset.kobj);
struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
obd_kset.kobj);
struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
- return snprintf(buf, PAGE_SIZE, "%lld\n", ofd->ofd_atime_diff);
+ return scnprintf(buf, PAGE_SIZE, "%lld\n", ofd->ofd_atime_diff);
obd_kset.kobj);
struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
obd_kset.kobj);
struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
- return snprintf(buf, PAGE_SIZE, "%u\n", ofd->ofd_no_precreate);
+ return scnprintf(buf, PAGE_SIZE, "%u\n", ofd->ofd_no_precreate);
obd_kset.kobj);
struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
obd_kset.kobj);
struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
- return snprintf(buf, PAGE_SIZE, "%s%s%s\n",
+ return scnprintf(buf, PAGE_SIZE, "%s%s%s\n",
(ofd->ofd_access_log_mask == 0) ? "0" : "",
(ofd->ofd_access_log_mask & OFD_ACCESS_READ) ? "r" : "",
(ofd->ofd_access_log_mask & OFD_ACCESS_WRITE) ? "w" : "");
(ofd->ofd_access_log_mask == 0) ? "0" : "",
(ofd->ofd_access_log_mask & OFD_ACCESS_READ) ? "r" : "",
(ofd->ofd_access_log_mask & OFD_ACCESS_WRITE) ? "w" : "");
obd_kset.kobj);
struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
obd_kset.kobj);
struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
- return snprintf(buf, PAGE_SIZE, "%u\n", ofd->ofd_access_log_size);
+ return scnprintf(buf, PAGE_SIZE, "%u\n", ofd->ofd_access_log_size);
}
static ssize_t access_log_size_store(struct kobject *kobj,
}
static ssize_t access_log_size_store(struct kobject *kobj,
*/
if (S_ISLNK(type)) {
BUILD_BUG_ON(LDISKFS_N_BLOCKS * 4 < FID_LEN + 1);
*/
if (S_ISLNK(type)) {
BUILD_BUG_ON(LDISKFS_N_BLOCKS * 4 < FID_LEN + 1);
- rc = snprintf((char *)LDISKFS_I(local)->i_data,
- LDISKFS_N_BLOCKS * 4, DFID, PFID(fid));
+ rc = scnprintf((char *)LDISKFS_I(local)->i_data,
+ LDISKFS_N_BLOCKS * 4, DFID, PFID(fid));
i_size_write(local, rc);
LDISKFS_I(local)->i_disksize = rc;
i_size_write(local, rc);
LDISKFS_I(local)->i_disksize = rc;
RETURN(-EROFS);
for (i = 0; i < OSD_OI_FID_NR_MAX; i++) {
RETURN(-EROFS);
for (i = 0; i < OSD_OI_FID_NR_MAX; i++) {
- namelen = snprintf(name, sizeof(name), "%s.%d",
- OSD_OI_NAME_BASE, i);
+ namelen = scnprintf(name, sizeof(name), "%s.%d",
+ OSD_OI_NAME_BASE, i);
rc = osd_remove_oi_one(osd, osd_sb(osd)->s_root, name, namelen);
if (rc != 0) {
CERROR(
rc = osd_remove_oi_one(osd, osd_sb(osd)->s_root, name, namelen);
if (rc != 0) {
CERROR(
- namelen = snprintf(name, sizeof(name), "%s", OSD_OI_NAME_BASE);
+ namelen = scnprintf(name, sizeof(name), "%s", OSD_OI_NAME_BASE);
rc = osd_remove_oi_one(osd, osd_sb(osd)->s_root, name, namelen);
if (rc != 0)
CERROR("%s: fail to remove the stale OI file %s: rc = %d\n",
rc = osd_remove_oi_one(osd, osd_sb(osd)->s_root, name, namelen);
if (rc != 0)
CERROR("%s: fail to remove the stale OI file %s: rc = %d\n",
}
int gss_display_kerberos(struct gss_ctx *ctx,
}
int gss_display_kerberos(struct gss_ctx *ctx,
- char *buf,
- int bufsize)
+ char *buf,
+ int bufsize)
- struct krb5_ctx *kctx = ctx->internal_ctx_id;
- int written;
+ struct krb5_ctx *kctx = ctx->internal_ctx_id;
+ int written;
- written = snprintf(buf, bufsize, "krb5 (%s)",
- enctype2str(kctx->kc_enctype));
- return written;
+ written = scnprintf(buf, bufsize, "krb5 (%s)",
+ enctype2str(kctx->kc_enctype));
+ return written;
}
static struct gss_api_ops gss_kerberos_ops = {
}
static struct gss_api_ops gss_kerberos_ops = {
int gss_display_null(struct gss_ctx *gss_context, char *buf, int bufsize)
{
int gss_display_null(struct gss_ctx *gss_context, char *buf, int bufsize)
{
- return snprintf(buf, bufsize, "null");
+ return scnprintf(buf, bufsize, "null");
int gss_display_sk(struct gss_ctx *gss_context, char *buf, int bufsize)
{
int gss_display_sk(struct gss_ctx *gss_context, char *buf, int bufsize)
{
- return snprintf(buf, bufsize, "sk");
+ return scnprintf(buf, bufsize, "sk");
}
static struct gss_api_ops gss_sk_ops = {
}
static struct gss_api_ops gss_sk_ops = {
static int ct_path_lustre(char *buf, int sz, const char *mnt,
const struct lu_fid *fid)
{
static int ct_path_lustre(char *buf, int sz, const char *mnt,
const struct lu_fid *fid)
{
- return snprintf(buf, sz, "%s/%s/fid/"DFID_NOBRACE, mnt,
- dot_lustre_name, PFID(fid));
+ return scnprintf(buf, sz, "%s/%s/fid/"DFID_NOBRACE, mnt,
+ dot_lustre_name, PFID(fid));
}
static int ct_path_archive(char *buf, int sz, const char *archive_dir,
const struct lu_fid *fid)
{
}
static int ct_path_archive(char *buf, int sz, const char *archive_dir,
const struct lu_fid *fid)
{
- return snprintf(buf, sz, "%s/%04x/%04x/%04x/%04x/%04x/%04x/"
- DFID_NOBRACE, archive_dir,
- (fid)->f_oid & 0xFFFF,
- (fid)->f_oid >> 16 & 0xFFFF,
- (unsigned int)((fid)->f_seq & 0xFFFF),
- (unsigned int)((fid)->f_seq >> 16 & 0xFFFF),
- (unsigned int)((fid)->f_seq >> 32 & 0xFFFF),
- (unsigned int)((fid)->f_seq >> 48 & 0xFFFF),
- PFID(fid));
+ return scnprintf(buf, sz, "%s/%04x/%04x/%04x/%04x/%04x/%04x/"
+ DFID_NOBRACE, archive_dir,
+ (fid)->f_oid & 0xFFFF,
+ (fid)->f_oid >> 16 & 0xFFFF,
+ (unsigned int)((fid)->f_seq & 0xFFFF),
+ (unsigned int)((fid)->f_seq >> 16 & 0xFFFF),
+ (unsigned int)((fid)->f_seq >> 32 & 0xFFFF),
+ (unsigned int)((fid)->f_seq >> 48 & 0xFFFF),
+ PFID(fid));
}
static bool ct_is_retryable(int err)
}
static bool ct_is_retryable(int err)