1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 **************************************************************************** 11 ****************************************************************************/ 12 #ifndef _SYSFS_H_ 13 #define _SYSFS_H_ 14 15 #include <asm/atomic.h> 16 17 struct kobject; 18 struct module; 19 20 struct attribute { 21 const char * name; 22 struct module * owner; 23 mode_t mode; 24 }; 25 26 struct attribute_group { 27 const char * name; 28 struct attribute ** attrs; 29 }; 30 31 #define __ATTR(_name,_mode,_show,_store) { .attr = {.name = __stringify(_name), .mode = _mode, .owner = THIS_MODULE }, .show = _show, .store = _store, } 32 33 #define __ATTR_RO(_name) { .attr = { .name = __stringify(_name), .mode = 0444, .owner = THIS_MODULE }, .show = _name##_show, } 34 35 #define __ATTR_NULL { .attr = { .name = NULL } } 36 37 #define attr_name(_attr) (_attr).attr.name 38 39 struct vm_area_struct; 40 41 struct bin_attribute { 42 struct attribute attr; 43 size_t size; 44 void *private; 45 ssize_t (*read)(struct kobject *, char *, loff_t, size_t); 46 ssize_t (*write)(struct kobject *, char *, loff_t, size_t); 47 int (*mmap)(struct kobject *, struct bin_attribute *attr, 48 struct vm_area_struct *vma); 49 }; 50 51 struct sysfs_ops { 52 ssize_t (*show)(struct kobject *, struct attribute *,char *); 53 ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t); 54 }; 55 56 struct sysfs_dirent { 57 atomic_t s_count; 58 struct list_head s_sibling; 59 struct list_head s_children; 60 void * s_element; 61 int s_type; 62 umode_t s_mode; 63 struct dentry * s_dentry; 64 struct iattr * s_iattr; 65 atomic_t s_event; 66 }; 67 68 #define SYSFS_ROOT 0x0001 69 #define SYSFS_DIR 0x0002 70 #define SYSFS_KOBJ_ATTR 0x0004 71 #define SYSFS_KOBJ_BIN_ATTR 0x0008 72 #define SYSFS_KOBJ_DEVICE 0x0010 73 #define SYSFS_KOBJ_LINK 0x0020 74 #define SYSFS_NOT_PINNED (SYSFS_KOBJ_ATTR | SYSFS_KOBJ_BIN_ATTR | SYSFS_KOBJ_DEVICE | SYSFS_KOBJ_LINK) 75 76 #endif 77