diff options
author | Coly Li <colyli@suse.de> | 2022-05-28 14:28:24 +0800 |
---|---|---|
committer | Coly Li <colyli@suse.de> | 2022-05-28 14:28:24 +0800 |
commit | d5d44ff109f4eebf9ba67917648d6a9ee5ddabab (patch) | |
tree | f64851211915cda4a321623bb1556dcae49f1001 | |
parent | b236ea2af4ecb5e5e77275f40d2dd76f02e4eee2 (diff) | |
download | bcache-patches-d5d44ff109f4eebf9ba67917648d6a9ee5ddabab.tar.gz |
for-next: remove the already merged 0001-bcache-replace-snprintf-in-show-functions-with-sysfs.patch
-rw-r--r-- | for-test/0001-bcache-replace-snprintf-in-show-functions-with-sysfs.patch | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/for-test/0001-bcache-replace-snprintf-in-show-functions-with-sysfs.patch b/for-test/0001-bcache-replace-snprintf-in-show-functions-with-sysfs.patch deleted file mode 100644 index 14afb49..0000000 --- a/for-test/0001-bcache-replace-snprintf-in-show-functions-with-sysfs.patch +++ /dev/null @@ -1,87 +0,0 @@ -From fb516a03533d6164a05eaaae2450d4d5ccdc2acd Mon Sep 17 00:00:00 2001 -From: Qing Wang <wangqing@vivo.com> -Date: Wed, 13 Oct 2021 04:58:17 -0700 -Subject: [PATCH 1/2] bcache: replace snprintf in show functions with - sysfs_emit - -coccicheck complains about the use of snprintf() in sysfs show functions. - -Fix the following coccicheck warning: -drivers/md/bcache/sysfs.h:54:12-20: WARNING: use scnprintf or sprintf. - -Implement sysfs_print() by sysfs_emit() and remove snprint() since no one -uses it any more. - -Suggested-by: Coly Li <colyli@suse.de> -Signed-off-by: Qing Wang <wangqing@vivo.com> -Signed-off-by: Coly Li <colyli@suse.de> ---- - drivers/md/bcache/sysfs.h | 18 ++++++++++++++++-- - drivers/md/bcache/util.h | 17 ----------------- - 2 files changed, 16 insertions(+), 19 deletions(-) - -diff --git a/drivers/md/bcache/sysfs.h b/drivers/md/bcache/sysfs.h -index 215df32f567b..c1752ba2e05b 100644 ---- a/drivers/md/bcache/sysfs.h -+++ b/drivers/md/bcache/sysfs.h -@@ -51,13 +51,27 @@ STORE(fn) \ - #define sysfs_printf(file, fmt, ...) \ - do { \ - if (attr == &sysfs_ ## file) \ -- return snprintf(buf, PAGE_SIZE, fmt "\n", __VA_ARGS__); \ -+ return sysfs_emit(buf, fmt "\n", __VA_ARGS__); \ - } while (0) - - #define sysfs_print(file, var) \ - do { \ - if (attr == &sysfs_ ## file) \ -- return snprint(buf, PAGE_SIZE, var); \ -+ return sysfs_emit(buf, \ -+ __builtin_types_compatible_p(typeof(var), int) \ -+ ? "%i\n" : \ -+ __builtin_types_compatible_p(typeof(var), unsigned int) \ -+ ? "%u\n" : \ -+ __builtin_types_compatible_p(typeof(var), long) \ -+ ? "%li\n" : \ -+ __builtin_types_compatible_p(typeof(var), unsigned long)\ -+ ? "%lu\n" : \ -+ __builtin_types_compatible_p(typeof(var), int64_t) \ -+ ? "%lli\n" : \ -+ __builtin_types_compatible_p(typeof(var), uint64_t) \ -+ ? "%llu\n" : \ -+ __builtin_types_compatible_p(typeof(var), const char *) \ -+ ? "%s\n" : "%i\n", var); \ - } while (0) - - #define sysfs_hprint(file, val) \ -diff --git a/drivers/md/bcache/util.h b/drivers/md/bcache/util.h -index b64460a76267..fecdea14a69e 100644 ---- a/drivers/md/bcache/util.h -+++ b/drivers/md/bcache/util.h -@@ -340,23 +340,6 @@ static inline int bch_strtoul_h(const char *cp, long *res) - _r; \ - }) - --#define snprint(buf, size, var) \ -- snprintf(buf, size, \ -- __builtin_types_compatible_p(typeof(var), int) \ -- ? "%i\n" : \ -- __builtin_types_compatible_p(typeof(var), unsigned int) \ -- ? "%u\n" : \ -- __builtin_types_compatible_p(typeof(var), long) \ -- ? "%li\n" : \ -- __builtin_types_compatible_p(typeof(var), unsigned long)\ -- ? "%lu\n" : \ -- __builtin_types_compatible_p(typeof(var), int64_t) \ -- ? "%lli\n" : \ -- __builtin_types_compatible_p(typeof(var), uint64_t) \ -- ? "%llu\n" : \ -- __builtin_types_compatible_p(typeof(var), const char *) \ -- ? "%s\n" : "%i\n", var) -- - ssize_t bch_hprint(char *buf, int64_t v); - - bool bch_is_zero(const char *p, size_t n); --- -2.31.1 - |