Linux Audio

Check our new training course

Loading...
Note: File does not exist in v3.1.
 1/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
 2#ifndef _BCACHE_FEATURES_H
 3#define _BCACHE_FEATURES_H
 4
 5#include <linux/bcache.h>
 6#include <linux/kernel.h>
 7#include <linux/types.h>
 8
 9#define BCH_FEATURE_COMPAT		0
10#define BCH_FEATURE_RO_COMPAT		1
11#define BCH_FEATURE_INCOMPAT		2
12#define BCH_FEATURE_TYPE_MASK		0x03
13
14/* Feature set definition */
15/* Incompat feature set */
16#define BCH_FEATURE_INCOMPAT_LARGE_BUCKET	0x0001 /* 32bit bucket size */
17
18#define BCH_FEATURE_COMPAT_SUUP		0
19#define BCH_FEATURE_RO_COMPAT_SUUP	0
20#define BCH_FEATURE_INCOMPAT_SUUP	BCH_FEATURE_INCOMPAT_LARGE_BUCKET
21
22#define BCH_HAS_COMPAT_FEATURE(sb, mask) \
23		((sb)->feature_compat & (mask))
24#define BCH_HAS_RO_COMPAT_FEATURE(sb, mask) \
25		((sb)->feature_ro_compat & (mask))
26#define BCH_HAS_INCOMPAT_FEATURE(sb, mask) \
27		((sb)->feature_incompat & (mask))
28
29#define BCH_FEATURE_COMPAT_FUNCS(name, flagname) \
30static inline int bch_has_feature_##name(struct cache_sb *sb) \
31{ \
32	return (((sb)->feature_compat & \
33		BCH##_FEATURE_COMPAT_##flagname) != 0); \
34} \
35static inline void bch_set_feature_##name(struct cache_sb *sb) \
36{ \
37	(sb)->feature_compat |= \
38		BCH##_FEATURE_COMPAT_##flagname; \
39} \
40static inline void bch_clear_feature_##name(struct cache_sb *sb) \
41{ \
42	(sb)->feature_compat &= \
43		~BCH##_FEATURE_COMPAT_##flagname; \
44}
45
46#define BCH_FEATURE_RO_COMPAT_FUNCS(name, flagname) \
47static inline int bch_has_feature_##name(struct cache_sb *sb) \
48{ \
49	return (((sb)->feature_ro_compat & \
50		BCH##_FEATURE_RO_COMPAT_##flagname) != 0); \
51} \
52static inline void bch_set_feature_##name(struct cache_sb *sb) \
53{ \
54	(sb)->feature_ro_compat |= \
55		BCH##_FEATURE_RO_COMPAT_##flagname; \
56} \
57static inline void bch_clear_feature_##name(struct cache_sb *sb) \
58{ \
59	(sb)->feature_ro_compat &= \
60		~BCH##_FEATURE_RO_COMPAT_##flagname; \
61}
62
63#define BCH_FEATURE_INCOMPAT_FUNCS(name, flagname) \
64static inline int bch_has_feature_##name(struct cache_sb *sb) \
65{ \
66	return (((sb)->feature_incompat & \
67		BCH##_FEATURE_INCOMPAT_##flagname) != 0); \
68} \
69static inline void bch_set_feature_##name(struct cache_sb *sb) \
70{ \
71	(sb)->feature_incompat |= \
72		BCH##_FEATURE_INCOMPAT_##flagname; \
73} \
74static inline void bch_clear_feature_##name(struct cache_sb *sb) \
75{ \
76	(sb)->feature_incompat &= \
77		~BCH##_FEATURE_INCOMPAT_##flagname; \
78}
79
80BCH_FEATURE_INCOMPAT_FUNCS(large_bucket, LARGE_BUCKET);
81
82int bch_print_cache_set_feature_compat(struct cache_set *c, char *buf, int size);
83int bch_print_cache_set_feature_ro_compat(struct cache_set *c, char *buf, int size);
84int bch_print_cache_set_feature_incompat(struct cache_set *c, char *buf, int size);
85
86#endif