aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/sys.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/gfs2/sys.c')
-rw-r--r--fs/gfs2/sys.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 0d7f0a4e371..88386d8dc05 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -32,12 +32,12 @@ spinlock_t gfs2_sys_margs_lock;
32 32
33static ssize_t id_show(struct gfs2_sbd *sdp, char *buf) 33static ssize_t id_show(struct gfs2_sbd *sdp, char *buf)
34{ 34{
35 return sprintf(buf, "%s\n", sdp->sd_vfs->s_id); 35 return snprintf(buf, PAGE_SIZE, "%s\n", sdp->sd_vfs->s_id);
36} 36}
37 37
38static ssize_t fsname_show(struct gfs2_sbd *sdp, char *buf) 38static ssize_t fsname_show(struct gfs2_sbd *sdp, char *buf)
39{ 39{
40 return sprintf(buf, "%s\n", sdp->sd_fsname); 40 return snprintf(buf, PAGE_SIZE, "%s\n", sdp->sd_fsname);
41} 41}
42 42
43static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf) 43static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf)
@@ -48,7 +48,7 @@ static ssize_t freeze_show(struct gfs2_sbd *sdp, char *buf)
48 count = sdp->sd_freeze_count; 48 count = sdp->sd_freeze_count;
49 mutex_unlock(&sdp->sd_freeze_lock); 49 mutex_unlock(&sdp->sd_freeze_lock);
50 50
51 return sprintf(buf, "%u\n", count); 51 return snprintf(buf, PAGE_SIZE, "%u\n", count);
52} 52}
53 53
54static ssize_t freeze_store(struct gfs2_sbd *sdp, const char *buf, size_t len) 54static ssize_t freeze_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
@@ -80,7 +80,7 @@ static ssize_t freeze_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
80static ssize_t withdraw_show(struct gfs2_sbd *sdp, char *buf) 80static ssize_t withdraw_show(struct gfs2_sbd *sdp, char *buf)
81{ 81{
82 unsigned int b = test_bit(SDF_SHUTDOWN, &sdp->sd_flags); 82 unsigned int b = test_bit(SDF_SHUTDOWN, &sdp->sd_flags);
83 return sprintf(buf, "%u\n", b); 83 return snprintf(buf, PAGE_SIZE, "%u\n", b);
84} 84}
85 85
86static ssize_t withdraw_store(struct gfs2_sbd *sdp, const char *buf, size_t len) 86static ssize_t withdraw_store(struct gfs2_sbd *sdp, const char *buf, size_t len)
@@ -239,7 +239,7 @@ struct lockstruct_attr {
239#define LOCKSTRUCT_ATTR(name, fmt) \ 239#define LOCKSTRUCT_ATTR(name, fmt) \
240static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \ 240static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \
241{ \ 241{ \
242 return sprintf(buf, fmt, sdp->sd_lockstruct.ls_##name); \ 242 return snprintf(buf, PAGE_SIZE, fmt, sdp->sd_lockstruct.ls_##name); \
243} \ 243} \
244static struct lockstruct_attr lockstruct_attr_##name = __ATTR_RO(name) 244static struct lockstruct_attr lockstruct_attr_##name = __ATTR_RO(name)
245 245
@@ -268,7 +268,7 @@ struct args_attr {
268#define ARGS_ATTR(name, fmt) \ 268#define ARGS_ATTR(name, fmt) \
269static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \ 269static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \
270{ \ 270{ \
271 return sprintf(buf, fmt, sdp->sd_args.ar_##name); \ 271 return snprintf(buf, PAGE_SIZE, fmt, sdp->sd_args.ar_##name); \
272} \ 272} \
273static struct args_attr args_attr_##name = __ATTR_RO(name) 273static struct args_attr args_attr_##name = __ATTR_RO(name)
274 274
@@ -290,7 +290,8 @@ ARGS_ATTR(data, "%d\n");
290/* one oddball doesn't fit the macro mold */ 290/* one oddball doesn't fit the macro mold */
291static ssize_t noatime_show(struct gfs2_sbd *sdp, char *buf) 291static ssize_t noatime_show(struct gfs2_sbd *sdp, char *buf)
292{ 292{
293 return sprintf(buf, "%d\n", !!test_bit(SDF_NOATIME, &sdp->sd_flags)); 293 return snprintf(buf, PAGE_SIZE, "%d\n",
294 !!test_bit(SDF_NOATIME, &sdp->sd_flags));
294} 295}
295static struct args_attr args_attr_noatime = __ATTR_RO(noatime); 296static struct args_attr args_attr_noatime = __ATTR_RO(noatime);
296 297
@@ -325,7 +326,8 @@ struct counters_attr {
325#define COUNTERS_ATTR(name, fmt) \ 326#define COUNTERS_ATTR(name, fmt) \
326static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \ 327static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \
327{ \ 328{ \
328 return sprintf(buf, fmt, (unsigned int)atomic_read(&sdp->sd_##name)); \ 329 return snprintf(buf, PAGE_SIZE, fmt, \
330 (unsigned int)atomic_read(&sdp->sd_##name)); \
329} \ 331} \
330static struct counters_attr counters_attr_##name = __ATTR_RO(name) 332static struct counters_attr counters_attr_##name = __ATTR_RO(name)
331 333
@@ -348,8 +350,9 @@ static struct attribute *counters_attrs[] = {
348 350
349static ssize_t quota_scale_show(struct gfs2_sbd *sdp, char *buf) 351static ssize_t quota_scale_show(struct gfs2_sbd *sdp, char *buf)
350{ 352{
351 return sprintf(buf, "%u %u\n", sdp->sd_tune.gt_quota_scale_num, 353 return snprintf(buf, PAGE_SIZE, "%u %u\n",
352 sdp->sd_tune.gt_quota_scale_den); 354 sdp->sd_tune.gt_quota_scale_num,
355 sdp->sd_tune.gt_quota_scale_den);
353} 356}
354 357
355static ssize_t quota_scale_store(struct gfs2_sbd *sdp, const char *buf, 358static ssize_t quota_scale_store(struct gfs2_sbd *sdp, const char *buf,
@@ -403,7 +406,7 @@ static struct tune_attr tune_attr_##name = __ATTR(name, 0644, show, store)
403#define TUNE_ATTR_2(name, store) \ 406#define TUNE_ATTR_2(name, store) \
404static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \ 407static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \
405{ \ 408{ \
406 return sprintf(buf, "%u\n", sdp->sd_tune.gt_##name); \ 409 return snprintf(buf, PAGE_SIZE, "%u\n", sdp->sd_tune.gt_##name); \
407} \ 410} \
408TUNE_ATTR_3(name, name##_show, store) 411TUNE_ATTR_3(name, name##_show, store)
409 412