Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros
sysfs.h File Reference
#include <linux/compiler.h>
#include <linux/errno.h>
#include <linux/list.h>
#include <linux/lockdep.h>
#include <linux/kobject_ns.h>
#include <linux/atomic.h>

Go to the source code of this file.

Data Structures

struct  attribute
 
struct  attribute_group
 
struct  bin_attribute
 
struct  sysfs_ops
 

Macros

#define sysfs_attr_init(attr)   do {} while(0)
 
#define __ATTR(_name, _mode, _show, _store)
 
#define __ATTR_RO(_name)
 
#define __ATTR_NULL   { .attr = { .name = NULL } }
 
#define __ATTR_IGNORE_LOCKDEP   __ATTR
 
#define attr_name(_attr)   (_attr).attr.name
 
#define sysfs_bin_attr_init(bin_attr)   sysfs_attr_init(&(bin_attr)->attr)
 

Macro Definition Documentation

#define __ATTR (   _name,
  _mode,
  _show,
  _store 
)
Value:
{ \
.attr = {.name = __stringify(_name), .mode = _mode }, \
.show = _show, \
.store = _store, \
}

Use these macros to make defining attributes easier. See include/linux/device.h for examples..

Definition at line 71 of file sysfs.h.

#define __ATTR_IGNORE_LOCKDEP   __ATTR

Definition at line 92 of file sysfs.h.

#define __ATTR_NULL   { .attr = { .name = NULL } }

Definition at line 82 of file sysfs.h.

#define __ATTR_RO (   _name)
Value:
{ \
.attr = { .name = __stringify(_name), .mode = 0444 }, \
.show = _name##_show, \
}

Definition at line 77 of file sysfs.h.

#define attr_name (   _attr)    (_attr).attr.name

Definition at line 95 of file sysfs.h.

#define sysfs_attr_init (   attr)    do {} while(0)

sysfs_attr_init - initialize a dynamically allocated sysfs attribute : struct attribute to initialize

Initialize a dynamically allocated struct attribute so we can make lockdep happy. This is a new requirement for attributes and initially this is only needed when lockdep is enabled. Lockdep gives a nice error when your attribute is added to sysfs if you don't have this.

Definition at line 54 of file sysfs.h.

#define sysfs_bin_attr_init (   bin_attr)    sysfs_attr_init(&(bin_attr)->attr)

sysfs_bin_attr_init - initialize a dynamically allocated bin_attribute : struct bin_attribute to initialize

Initialize a dynamically allocated struct bin_attribute so we can make lockdep happy. This is a new requirement for attributes and initially this is only needed when lockdep is enabled. Lockdep gives a nice error when your attribute is added to sysfs if you don't have this.

Definition at line 122 of file sysfs.h.