~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/raid_class.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * raid_class.h - a generic raid visualisation class
  4  *
  5  * Copyright (c) 2005 - James Bottomley <James.Bottomley@steeleye.com>
  6  */
  7 #include <linux/transport_class.h>
  8 
  9 struct raid_template {
 10         struct transport_container raid_attrs;
 11 };
 12 
 13 struct raid_function_template {
 14         const void *cookie;
 15         int (*is_raid)(struct device *);
 16         void (*get_resync)(struct device *);
 17         void (*get_state)(struct device *);
 18 };
 19 
 20 enum raid_state {
 21         RAID_STATE_UNKNOWN = 0,
 22         RAID_STATE_ACTIVE,
 23         RAID_STATE_DEGRADED,
 24         RAID_STATE_RESYNCING,
 25         RAID_STATE_OFFLINE,
 26 };
 27 
 28 enum raid_level {
 29         RAID_LEVEL_UNKNOWN = 0,
 30         RAID_LEVEL_LINEAR,
 31         RAID_LEVEL_0,
 32         RAID_LEVEL_1,
 33         RAID_LEVEL_10,
 34         RAID_LEVEL_1E,
 35         RAID_LEVEL_3,
 36         RAID_LEVEL_4,
 37         RAID_LEVEL_5,
 38         RAID_LEVEL_50,
 39         RAID_LEVEL_6,
 40         RAID_LEVEL_JBOD,
 41 };
 42 
 43 struct raid_data {
 44         struct list_head component_list;
 45         int component_count;
 46         enum raid_level level;
 47         enum raid_state state;
 48         int resync;
 49 };
 50 
 51 /* resync complete goes from 0 to this */
 52 #define RAID_MAX_RESYNC         (10000)
 53 
 54 #define DEFINE_RAID_ATTRIBUTE(type, attr)                                     \
 55 static inline void                                                            \
 56 raid_set_##attr(struct raid_template *r, struct device *dev, type value) {    \
 57         struct device *device =                                               \
 58                 attribute_container_find_class_device(&r->raid_attrs.ac, dev);\
 59         struct raid_data *rd;                                                 \
 60         BUG_ON(!device);                                                      \
 61         rd = dev_get_drvdata(device);                                         \
 62         rd->attr = value;                                                     \
 63 }                                                                             \
 64 static inline type                                                            \
 65 raid_get_##attr(struct raid_template *r, struct device *dev) {                \
 66         struct device *device =                                               \
 67                 attribute_container_find_class_device(&r->raid_attrs.ac, dev);\
 68         struct raid_data *rd;                                                 \
 69         BUG_ON(!device);                                                      \
 70         rd = dev_get_drvdata(device);                                         \
 71         return rd->attr;                                                      \
 72 }
 73 
 74 DEFINE_RAID_ATTRIBUTE(enum raid_level, level)
 75 DEFINE_RAID_ATTRIBUTE(int, resync)
 76 DEFINE_RAID_ATTRIBUTE(enum raid_state, state)
 77         
 78 struct raid_template *raid_class_attach(struct raid_function_template *);
 79 void raid_class_release(struct raid_template *);
 80 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php