Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
enclosure.c File Reference
#include <linux/device.h>
#include <linux/enclosure.h>
#include <linux/err.h>
#include <linux/list.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/slab.h>

Go to the source code of this file.

Macros

#define ENCLOSURE_NAME_SIZE   64
 

Functions

struct enclosure_deviceenclosure_find (struct device *dev, struct enclosure_device *start)
 
 EXPORT_SYMBOL_GPL (enclosure_find)
 
int enclosure_for_each_device (int(*fn)(struct enclosure_device *, void *), void *data)
 
 EXPORT_SYMBOL_GPL (enclosure_for_each_device)
 
struct enclosure_deviceenclosure_register (struct device *dev, const char *name, int components, struct enclosure_component_callbacks *cb)
 
 EXPORT_SYMBOL_GPL (enclosure_register)
 
void enclosure_unregister (struct enclosure_device *edev)
 
 EXPORT_SYMBOL_GPL (enclosure_unregister)
 

: an optional name to appear in sysfs (leave NULL if none)

enclosure_component_register - add a particular component to an enclosure : the enclosure to add the component : the device number : the type of component being added

Registers the component. The name is optional for enclosures that give their components a unique name. If not, leave the field NULL and a name will be assigned.

Returns a pointer to the enclosure component or an error.

struct enclosure_componentenclosure_component_register (struct enclosure_device *edev, unsigned int number, enum enclosure_component_type type, const char *name)
 
 EXPORT_SYMBOL_GPL (enclosure_component_register)
 
int enclosure_add_device (struct enclosure_device *edev, int component, struct device *dev)
 
 EXPORT_SYMBOL_GPL (enclosure_add_device)
 
int enclosure_remove_device (struct enclosure_device *edev, struct device *dev)
 
 EXPORT_SYMBOL_GPL (enclosure_remove_device)
 
 module_init (enclosure_init)
 
 module_exit (enclosure_exit)
 
 MODULE_AUTHOR ("James Bottomley")
 
 MODULE_DESCRIPTION ("Enclosure Services")
 
 MODULE_LICENSE ("GPL v2")
 

Macro Definition Documentation

#define ENCLOSURE_NAME_SIZE   64

Definition at line 189 of file enclosure.c.

Function Documentation

int enclosure_add_device ( struct enclosure_device edev,
int  component,
struct device dev 
)

enclosure_add_device - add a device as being part of an enclosure : the enclosure device being added to. : the number of the component : the device being added

Declares a real device to reside in slot (or identifier) of an enclosure. This will cause the relevant sysfs links to appear. This function may also be used to change a device associated with an enclosure without having to call enclosure_remove_device() in between.

Returns zero on success or an error.

Definition at line 312 of file enclosure.c.

struct enclosure_component* enclosure_component_register ( struct enclosure_device edev,
unsigned int  number,
enum enclosure_component_type  type,
const char name 
)
read

Definition at line 258 of file enclosure.c.

struct enclosure_device* enclosure_find ( struct device dev,
struct enclosure_device start 
)
read

enclosure_find - find an enclosure given a parent device : the parent to match against : Optional enclosure device to start from (NULL if none)

Looks through the list of registered enclosures to find all those with as a parent. Returns NULL if no enclosure is found. can be used as a starting point to obtain multiple enclosures per parent (should begin with NULL and then be set to each returned enclosure device). Obtains a reference to the enclosure class device which must be released with device_put(). If is not NULL, a reference must be taken on it which is released before returning (this allows a loop through all enclosures to exit with only the reference on the enclosure of interest held). Note that the may correspond to the actual device housing the enclosure, in which case no iteration via is required.

Definition at line 54 of file enclosure.c.

int enclosure_for_each_device ( int(*)(struct enclosure_device *, void *)  fn,
void data 
)

Definition at line 95 of file enclosure.c.

struct enclosure_device* enclosure_register ( struct device dev,
const char name,
int  components,
struct enclosure_component_callbacks cb 
)
read

enclosure_register - register device as an enclosure

: device containing the enclosure : number of components in the enclosure

This sets up the device for being an enclosure. Note that does not have to be a dedicated enclosure device. It may be some other type of device that additionally responds to enclosure services

Definition at line 124 of file enclosure.c.

int enclosure_remove_device ( struct enclosure_device edev,
struct device dev 
)

enclosure_remove_device - remove a device from an enclosure : the enclosure device : the number of the component to remove

Returns zero on success or an error.

Definition at line 342 of file enclosure.c.

void enclosure_unregister ( struct enclosure_device edev)

enclosure_unregister - remove an enclosure

: the registered enclosure to remove;

Definition at line 171 of file enclosure.c.

EXPORT_SYMBOL_GPL ( enclosure_find  )
EXPORT_SYMBOL_GPL ( enclosure_for_each_device  )
EXPORT_SYMBOL_GPL ( enclosure_register  )
EXPORT_SYMBOL_GPL ( enclosure_unregister  )
EXPORT_SYMBOL_GPL ( enclosure_component_register  )
EXPORT_SYMBOL_GPL ( enclosure_add_device  )
EXPORT_SYMBOL_GPL ( enclosure_remove_device  )
MODULE_AUTHOR ( "James Bottomley"  )
MODULE_DESCRIPTION ( "Enclosure Services"  )
module_exit ( enclosure_exit  )
module_init ( enclosure_init  )
MODULE_LICENSE ( "GPL v2 )