X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=fs%2Fgfs2%2Fsys.c;h=0e0ec988f731c5ffd19306fcf34679c05ffa03d2;hb=abbdbd2065e74411dc2c401501c2c85a82f60e06;hp=79199738c3891cbf31c3d18e24e95bd5f439d464;hpb=a91ea69ffd3f8a0b7139bfd44042ab384461e631;p=powerpc.git diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c index 79199738c3..0e0ec988f7 100644 --- a/fs/gfs2/sys.c +++ b/fs/gfs2/sys.c @@ -15,10 +15,10 @@ #include #include #include +#include #include #include "gfs2.h" -#include "lm_interface.h" #include "incore.h" #include "lm.h" #include "sys.h" @@ -32,12 +32,12 @@ spinlock_t gfs2_sys_margs_lock; static ssize_t id_show(struct gfs2_sbd *sdp, char *buf) { - return sprintf(buf, "%s\n", sdp->sd_vfs->s_id); + return snprintf(buf, PAGE_SIZE, "%s\n", sdp->sd_vfs->s_id); } static ssize_t fsname_show(struct gfs2_sbd *sdp, char *buf) { - return sprintf(buf, "%s\n", sdp->sd_fsname); + return snprintf(buf, PAGE_SIZE, "%s\n", sdp->sd_fsname); } static 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) count = sdp->sd_freeze_count; mutex_unlock(&sdp->sd_freeze_lock); - return sprintf(buf, "%u\n", count); + return snprintf(buf, PAGE_SIZE, "%u\n", count); } static 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) static ssize_t withdraw_show(struct gfs2_sbd *sdp, char *buf) { unsigned int b = test_bit(SDF_SHUTDOWN, &sdp->sd_flags); - return sprintf(buf, "%u\n", b); + return snprintf(buf, PAGE_SIZE, "%u\n", b); } static ssize_t withdraw_store(struct gfs2_sbd *sdp, const char *buf, size_t len) @@ -138,7 +138,7 @@ static ssize_t quota_sync_store(struct gfs2_sbd *sdp, const char *buf, static ssize_t quota_refresh_user_store(struct gfs2_sbd *sdp, const char *buf, size_t len) { - uint32_t id; + u32 id; if (!capable(CAP_SYS_ADMIN)) return -EACCES; @@ -152,7 +152,7 @@ static ssize_t quota_refresh_user_store(struct gfs2_sbd *sdp, const char *buf, static ssize_t quota_refresh_group_store(struct gfs2_sbd *sdp, const char *buf, size_t len) { - uint32_t id; + u32 id; if (!capable(CAP_SYS_ADMIN)) return -EACCES; @@ -223,7 +223,7 @@ static struct kobj_type gfs2_ktype = { static struct kset gfs2_kset = { .subsys = &fs_subsys, - .kobj = {.name = "gfs2",}, + .kobj = {.name = "gfs2"}, .ktype = &gfs2_ktype, }; @@ -239,7 +239,7 @@ struct lockstruct_attr { #define LOCKSTRUCT_ATTR(name, fmt) \ static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \ { \ - return sprintf(buf, fmt, sdp->sd_lockstruct.ls_##name); \ + return snprintf(buf, PAGE_SIZE, fmt, sdp->sd_lockstruct.ls_##name); \ } \ static struct lockstruct_attr lockstruct_attr_##name = __ATTR_RO(name) @@ -253,7 +253,7 @@ static struct attribute *lockstruct_attrs[] = { &lockstruct_attr_first.attr, &lockstruct_attr_lvb_size.attr, &lockstruct_attr_flags.attr, - NULL + NULL, }; /* @@ -268,7 +268,7 @@ struct args_attr { #define ARGS_ATTR(name, fmt) \ static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \ { \ - return sprintf(buf, fmt, sdp->sd_args.ar_##name); \ + return snprintf(buf, PAGE_SIZE, fmt, sdp->sd_args.ar_##name); \ } \ static struct args_attr args_attr_##name = __ATTR_RO(name) @@ -290,7 +290,8 @@ ARGS_ATTR(data, "%d\n"); /* one oddball doesn't fit the macro mold */ static ssize_t noatime_show(struct gfs2_sbd *sdp, char *buf) { - return sprintf(buf, "%d\n", !!test_bit(SDF_NOATIME, &sdp->sd_flags)); + return snprintf(buf, PAGE_SIZE, "%d\n", + !!test_bit(SDF_NOATIME, &sdp->sd_flags)); } static struct args_attr args_attr_noatime = __ATTR_RO(noatime); @@ -310,7 +311,7 @@ static struct attribute *args_attrs[] = { &args_attr_suiddir.attr, &args_attr_data.attr, &args_attr_noatime.attr, - NULL + NULL, }; /* @@ -325,7 +326,8 @@ struct counters_attr { #define COUNTERS_ATTR(name, fmt) \ static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \ { \ - return sprintf(buf, fmt, (unsigned int)atomic_read(&sdp->sd_##name)); \ + return snprintf(buf, PAGE_SIZE, fmt, \ + (unsigned int)atomic_read(&sdp->sd_##name)); \ } \ static struct counters_attr counters_attr_##name = __ATTR_RO(name) @@ -339,7 +341,7 @@ static struct attribute *counters_attrs[] = { &counters_attr_glock_held_count.attr, &counters_attr_inode_count.attr, &counters_attr_reclaimed.attr, - NULL + NULL, }; /* @@ -348,8 +350,9 @@ static struct attribute *counters_attrs[] = { static ssize_t quota_scale_show(struct gfs2_sbd *sdp, char *buf) { - return sprintf(buf, "%u %u\n", sdp->sd_tune.gt_quota_scale_num, - sdp->sd_tune.gt_quota_scale_den); + return snprintf(buf, PAGE_SIZE, "%u %u\n", + sdp->sd_tune.gt_quota_scale_num, + sdp->sd_tune.gt_quota_scale_den); } static 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) #define TUNE_ATTR_2(name, store) \ static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \ { \ - return sprintf(buf, "%u\n", sdp->sd_tune.gt_##name); \ + return snprintf(buf, PAGE_SIZE, "%u\n", sdp->sd_tune.gt_##name); \ } \ TUNE_ATTR_3(name, name##_show, store) @@ -487,27 +490,27 @@ static struct attribute *tune_attrs[] = { &tune_attr_quota_scale.attr, &tune_attr_new_files_jdata.attr, &tune_attr_new_files_directio.attr, - NULL + NULL, }; static struct attribute_group lockstruct_group = { .name = "lockstruct", - .attrs = lockstruct_attrs + .attrs = lockstruct_attrs, }; static struct attribute_group counters_group = { .name = "counters", - .attrs = counters_attrs + .attrs = counters_attrs, }; static struct attribute_group args_group = { .name = "args", - .attrs = args_attrs + .attrs = args_attrs, }; static struct attribute_group tune_group = { .name = "tune", - .attrs = tune_attrs + .attrs = tune_attrs, }; int gfs2_sys_fs_add(struct gfs2_sbd *sdp) @@ -552,6 +555,7 @@ fail_lockstruct: fail_reg: kobject_unregister(&sdp->sd_kobj); fail: + fs_err(sdp, "error %d adding sysfs files", error); return error; }