sysfs.c (46fee692eebb850b8478531e185fb5a5f942d3ea) | sysfs.c (a10195764901e0a41e64d596de57a957e7f982f0) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * bcache sysfs interfaces 4 * 5 * Copyright 2010, 2011 Kent Overstreet <kent.overstreet@gmail.com> 6 * Copyright 2012 Google, Inc. 7 */ 8 --- 75 unchanged lines hidden (view full) --- 84 \ 85static ssize_t fn ## _store_inner(struct kobject *kobj, struct attribute *attr,\ 86 const char *buf, size_t size) 87 88#define __sysfs_attribute(_name, _mode) \ 89 static struct attribute sysfs_##_name = \ 90 { .name = #_name, .mode = _mode } 91 | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * bcache sysfs interfaces 4 * 5 * Copyright 2010, 2011 Kent Overstreet <kent.overstreet@gmail.com> 6 * Copyright 2012 Google, Inc. 7 */ 8 --- 75 unchanged lines hidden (view full) --- 84 \ 85static ssize_t fn ## _store_inner(struct kobject *kobj, struct attribute *attr,\ 86 const char *buf, size_t size) 87 88#define __sysfs_attribute(_name, _mode) \ 89 static struct attribute sysfs_##_name = \ 90 { .name = #_name, .mode = _mode } 91 |
92#define write_attribute(n) __sysfs_attribute(n, S_IWUSR) 93#define read_attribute(n) __sysfs_attribute(n, S_IRUGO) 94#define rw_attribute(n) __sysfs_attribute(n, S_IRUGO|S_IWUSR) | 92#define write_attribute(n) __sysfs_attribute(n, 0200) 93#define read_attribute(n) __sysfs_attribute(n, 0444) 94#define rw_attribute(n) __sysfs_attribute(n, 0644) |
95 96#define sysfs_printf(file, fmt, ...) \ 97do { \ 98 if (attr == &sysfs_ ## file) \ 99 prt_printf(out, fmt "\n", __VA_ARGS__); \ 100} while (0) 101 102#define sysfs_print(file, var) \ --- 120 unchanged lines hidden (view full) --- 223read_attribute(data_jobs); 224 225#ifdef CONFIG_BCACHEFS_TESTS 226write_attribute(perf_test); 227#endif /* CONFIG_BCACHEFS_TESTS */ 228 229#define x(_name) \ 230 static struct attribute sysfs_time_stat_##_name = \ | 95 96#define sysfs_printf(file, fmt, ...) \ 97do { \ 98 if (attr == &sysfs_ ## file) \ 99 prt_printf(out, fmt "\n", __VA_ARGS__); \ 100} while (0) 101 102#define sysfs_print(file, var) \ --- 120 unchanged lines hidden (view full) --- 223read_attribute(data_jobs); 224 225#ifdef CONFIG_BCACHEFS_TESTS 226write_attribute(perf_test); 227#endif /* CONFIG_BCACHEFS_TESTS */ 228 229#define x(_name) \ 230 static struct attribute sysfs_time_stat_##_name = \ |
231 { .name = #_name, .mode = S_IRUGO }; | 231 { .name = #_name, .mode = 0444 }; |
232 BCH_TIME_STATS() 233#undef x 234 235static struct attribute sysfs_state_rw = { 236 .name = "state", | 232 BCH_TIME_STATS() 233#undef x 234 235static struct attribute sysfs_state_rw = { 236 .name = "state", |
237 .mode = S_IRUGO | 237 .mode = 0444, |
238}; 239 240static size_t bch2_btree_cache_size(struct bch_fs *c) 241{ 242 size_t ret = 0; 243 struct btree *b; 244 245 mutex_lock(&c->btree_cache.lock); --- 359 unchanged lines hidden (view full) --- 605#undef x 606 NULL 607}; 608/* internal dir - just a wrapper */ 609 610SHOW(bch2_fs_internal) 611{ 612 struct bch_fs *c = container_of(kobj, struct bch_fs, internal); | 238}; 239 240static size_t bch2_btree_cache_size(struct bch_fs *c) 241{ 242 size_t ret = 0; 243 struct btree *b; 244 245 mutex_lock(&c->btree_cache.lock); --- 359 unchanged lines hidden (view full) --- 605#undef x 606 NULL 607}; 608/* internal dir - just a wrapper */ 609 610SHOW(bch2_fs_internal) 611{ 612 struct bch_fs *c = container_of(kobj, struct bch_fs, internal); |
613 |
|
613 return bch2_fs_to_text(out, &c->kobj, attr); 614} 615 616STORE(bch2_fs_internal) 617{ 618 struct bch_fs *c = container_of(kobj, struct bch_fs, internal); | 614 return bch2_fs_to_text(out, &c->kobj, attr); 615} 616 617STORE(bch2_fs_internal) 618{ 619 struct bch_fs *c = container_of(kobj, struct bch_fs, internal); |
620 |
|
619 return bch2_fs_store(&c->kobj, attr, buf, size); 620} 621SYSFS_OPS(bch2_fs_internal); 622 623struct attribute *bch2_fs_internal_files[] = { 624 &sysfs_journal_debug, 625 &sysfs_btree_updates, 626 &sysfs_btree_cache, --- 339 unchanged lines hidden --- | 621 return bch2_fs_store(&c->kobj, attr, buf, size); 622} 623SYSFS_OPS(bch2_fs_internal); 624 625struct attribute *bch2_fs_internal_files[] = { 626 &sysfs_journal_debug, 627 &sysfs_btree_updates, 628 &sysfs_btree_cache, --- 339 unchanged lines hidden --- |