Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
enclosure.h
Go to the documentation of this file.
1 /*
2  * Enclosure Services
3  *
4  * Copyright (C) 2008 James Bottomley <[email protected]>
5  *
6 **-----------------------------------------------------------------------------
7 **
8 ** This program is free software; you can redistribute it and/or
9 ** modify it under the terms of the GNU General Public License
10 ** version 2 as published by the Free Software Foundation.
11 **
12 ** This program is distributed in the hope that it will be useful,
13 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ** GNU General Public License for more details.
16 **
17 ** You should have received a copy of the GNU General Public License
18 ** along with this program; if not, write to the Free Software
19 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 **
21 **-----------------------------------------------------------------------------
22 */
23 #ifndef _LINUX_ENCLOSURE_H_
24 #define _LINUX_ENCLOSURE_H_
25 
26 #include <linux/device.h>
27 #include <linux/list.h>
28 
29 /* A few generic types ... taken from ses-2 */
33 };
34 
35 /* ses-2 common element status */
45  /* last element for counting purposes */
47 };
48 
49 /* SFF-8485 activity light settings */
57 };
58 
59 struct enclosure_device;
60 struct enclosure_component;
63  struct enclosure_component *);
65  struct enclosure_component *,
66  enum enclosure_status);
68  struct enclosure_component *);
70  struct enclosure_component *,
73  struct enclosure_component *);
75  struct enclosure_component *,
78  struct enclosure_component *);
80  struct enclosure_component *,
82 };
83 
84 
86  void *scratch;
87  struct device cdev;
88  struct device *dev;
90  int number;
91  int fault;
92  int active;
93  int locate;
95 };
96 
98  void *scratch;
99  struct list_head node;
100  struct device edev;
104 };
105 
106 static inline struct enclosure_device *
107 to_enclosure_device(struct device *dev)
108 {
109  return container_of(dev, struct enclosure_device, edev);
110 }
111 
112 static inline struct enclosure_component *
113 to_enclosure_component(struct device *dev)
114 {
115  return container_of(dev, struct enclosure_component, cdev);
116 }
117 
118 struct enclosure_device *
119 enclosure_register(struct device *, const char *, int,
122 struct enclosure_component *
123 enclosure_component_register(struct enclosure_device *, unsigned int,
124  enum enclosure_component_type, const char *);
125 int enclosure_add_device(struct enclosure_device *enclosure, int component,
126  struct device *dev);
127 int enclosure_remove_device(struct enclosure_device *, struct device *);
128 struct enclosure_device *enclosure_find(struct device *dev,
129  struct enclosure_device *start);
130 int enclosure_for_each_device(int (*fn)(struct enclosure_device *, void *),
131  void *data);
132 
133 #endif /* _LINUX_ENCLOSURE_H_ */