.. | .. |
---|
3 | 3 | #ifndef BTRFS_SYSFS_H |
---|
4 | 4 | #define BTRFS_SYSFS_H |
---|
5 | 5 | |
---|
6 | | -/* |
---|
7 | | - * Data exported through sysfs |
---|
8 | | - */ |
---|
9 | | -extern u64 btrfs_debugfs_test; |
---|
| 6 | +#include <linux/kobject.h> |
---|
10 | 7 | |
---|
11 | 8 | enum btrfs_feature_set { |
---|
12 | | - FEAT_COMPAT = 0, |
---|
| 9 | + FEAT_COMPAT, |
---|
13 | 10 | FEAT_COMPAT_RO, |
---|
14 | 11 | FEAT_INCOMPAT, |
---|
15 | 12 | FEAT_MAX |
---|
16 | 13 | }; |
---|
17 | 14 | |
---|
18 | | -#define __INIT_KOBJ_ATTR(_name, _mode, _show, _store) \ |
---|
19 | | -{ \ |
---|
20 | | - .attr = { .name = __stringify(_name), .mode = _mode }, \ |
---|
21 | | - .show = _show, \ |
---|
22 | | - .store = _store, \ |
---|
23 | | -} |
---|
24 | | - |
---|
25 | | -#define BTRFS_ATTR_RW(_prefix, _name, _show, _store) \ |
---|
26 | | - static struct kobj_attribute btrfs_attr_##_prefix##_##_name = \ |
---|
27 | | - __INIT_KOBJ_ATTR(_name, 0644, _show, _store) |
---|
28 | | - |
---|
29 | | -#define BTRFS_ATTR(_prefix, _name, _show) \ |
---|
30 | | - static struct kobj_attribute btrfs_attr_##_prefix##_##_name = \ |
---|
31 | | - __INIT_KOBJ_ATTR(_name, 0444, _show, NULL) |
---|
32 | | - |
---|
33 | | -#define BTRFS_ATTR_PTR(_prefix, _name) \ |
---|
34 | | - (&btrfs_attr_##_prefix##_##_name.attr) |
---|
35 | | - |
---|
36 | | - |
---|
37 | | -struct btrfs_feature_attr { |
---|
38 | | - struct kobj_attribute kobj_attr; |
---|
39 | | - enum btrfs_feature_set feature_set; |
---|
40 | | - u64 feature_bit; |
---|
41 | | -}; |
---|
42 | | - |
---|
43 | | -#define BTRFS_FEAT_ATTR(_name, _feature_set, _feature_prefix, _feature_bit) \ |
---|
44 | | -static struct btrfs_feature_attr btrfs_attr_features_##_name = { \ |
---|
45 | | - .kobj_attr = __INIT_KOBJ_ATTR(_name, S_IRUGO, \ |
---|
46 | | - btrfs_feature_attr_show, \ |
---|
47 | | - btrfs_feature_attr_store), \ |
---|
48 | | - .feature_set = _feature_set, \ |
---|
49 | | - .feature_bit = _feature_prefix ##_## _feature_bit, \ |
---|
50 | | -} |
---|
51 | | -#define BTRFS_FEAT_ATTR_PTR(_name) \ |
---|
52 | | - (&btrfs_attr_features_##_name.kobj_attr.attr) |
---|
53 | | - |
---|
54 | | -#define BTRFS_FEAT_ATTR_COMPAT(name, feature) \ |
---|
55 | | - BTRFS_FEAT_ATTR(name, FEAT_COMPAT, BTRFS_FEATURE_COMPAT, feature) |
---|
56 | | -#define BTRFS_FEAT_ATTR_COMPAT_RO(name, feature) \ |
---|
57 | | - BTRFS_FEAT_ATTR(name, FEAT_COMPAT_RO, BTRFS_FEATURE_COMPAT_RO, feature) |
---|
58 | | -#define BTRFS_FEAT_ATTR_INCOMPAT(name, feature) \ |
---|
59 | | - BTRFS_FEAT_ATTR(name, FEAT_INCOMPAT, BTRFS_FEATURE_INCOMPAT, feature) |
---|
60 | | - |
---|
61 | | -/* convert from attribute */ |
---|
62 | | -static inline struct btrfs_feature_attr * |
---|
63 | | -to_btrfs_feature_attr(struct kobj_attribute *a) |
---|
64 | | -{ |
---|
65 | | - return container_of(a, struct btrfs_feature_attr, kobj_attr); |
---|
66 | | -} |
---|
67 | | - |
---|
68 | | -static inline struct kobj_attribute *attr_to_btrfs_attr(struct attribute *attr) |
---|
69 | | -{ |
---|
70 | | - return container_of(attr, struct kobj_attribute, attr); |
---|
71 | | -} |
---|
72 | | - |
---|
73 | | -static inline struct btrfs_feature_attr * |
---|
74 | | -attr_to_btrfs_feature_attr(struct attribute *attr) |
---|
75 | | -{ |
---|
76 | | - return to_btrfs_feature_attr(attr_to_btrfs_attr(attr)); |
---|
77 | | -} |
---|
78 | | - |
---|
79 | 15 | char *btrfs_printable_features(enum btrfs_feature_set set, u64 flags); |
---|
80 | | -extern const char * const btrfs_feature_set_names[FEAT_MAX]; |
---|
81 | | -extern struct kobj_type space_info_ktype; |
---|
82 | | -extern struct kobj_type btrfs_raid_ktype; |
---|
83 | | -int btrfs_sysfs_add_device_link(struct btrfs_fs_devices *fs_devices, |
---|
84 | | - struct btrfs_device *one_device); |
---|
85 | | -int btrfs_sysfs_rm_device_link(struct btrfs_fs_devices *fs_devices, |
---|
86 | | - struct btrfs_device *one_device); |
---|
87 | | -int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs, |
---|
88 | | - struct kobject *parent); |
---|
89 | | -int btrfs_sysfs_add_device(struct btrfs_fs_devices *fs_devs); |
---|
| 16 | +const char *btrfs_feature_set_name(enum btrfs_feature_set set); |
---|
| 17 | +int btrfs_sysfs_add_device(struct btrfs_device *device); |
---|
| 18 | +void btrfs_sysfs_remove_device(struct btrfs_device *device); |
---|
| 19 | +int btrfs_sysfs_add_fsid(struct btrfs_fs_devices *fs_devs); |
---|
90 | 20 | void btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs); |
---|
| 21 | +void btrfs_sysfs_update_sprout_fsid(struct btrfs_fs_devices *fs_devices); |
---|
91 | 22 | void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info, |
---|
92 | 23 | u64 bit, enum btrfs_feature_set set); |
---|
| 24 | +void btrfs_kobject_uevent(struct block_device *bdev, enum kobject_action action); |
---|
| 25 | + |
---|
| 26 | +int __init btrfs_init_sysfs(void); |
---|
| 27 | +void __cold btrfs_exit_sysfs(void); |
---|
| 28 | +int btrfs_sysfs_add_mounted(struct btrfs_fs_info *fs_info); |
---|
| 29 | +void btrfs_sysfs_remove_mounted(struct btrfs_fs_info *fs_info); |
---|
| 30 | +void btrfs_sysfs_add_block_group_type(struct btrfs_block_group *cache); |
---|
| 31 | +int btrfs_sysfs_add_space_info_type(struct btrfs_fs_info *fs_info, |
---|
| 32 | + struct btrfs_space_info *space_info); |
---|
| 33 | +void btrfs_sysfs_remove_space_info(struct btrfs_space_info *space_info); |
---|
| 34 | +void btrfs_sysfs_update_devid(struct btrfs_device *device); |
---|
| 35 | + |
---|
| 36 | +int btrfs_sysfs_add_one_qgroup(struct btrfs_fs_info *fs_info, |
---|
| 37 | + struct btrfs_qgroup *qgroup); |
---|
| 38 | +void btrfs_sysfs_del_qgroups(struct btrfs_fs_info *fs_info); |
---|
| 39 | +int btrfs_sysfs_add_qgroups(struct btrfs_fs_info *fs_info); |
---|
| 40 | +void btrfs_sysfs_del_one_qgroup(struct btrfs_fs_info *fs_info, |
---|
| 41 | + struct btrfs_qgroup *qgroup); |
---|
93 | 42 | |
---|
94 | 43 | #endif |
---|