diff options
| author | Patrick Mochel <mochel@osdl.org> | 2002-10-29 07:14:59 -0800 |
|---|---|---|
| committer | Patrick Mochel <mochel@osdl.org> | 2002-10-29 07:14:59 -0800 |
| commit | d2f8eca7b0d7ef4503e40f809fb8d12e9d1d5389 (patch) | |
| tree | 70668b6fc908d303ad7ebec42633f5422867e00e /include/linux | |
| parent | d8c084f9fd65a1bf948acc5bf08b066f85160cba (diff) | |
| parent | eda520259938bd3299486f12ab5058c29dcd5326 (diff) | |
Merge osdl.org:/home/mochel/src/kernel/devel/linux-2.5-virgin
into osdl.org:/home/mochel/src/kernel/devel/linux-2.5-kobject
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/kobject.h | 30 | ||||
| -rw-r--r-- | include/linux/sysfs.h | 26 |
2 files changed, 42 insertions, 14 deletions
diff --git a/include/linux/kobject.h b/include/linux/kobject.h new file mode 100644 index 000000000000..12431a980712 --- /dev/null +++ b/include/linux/kobject.h @@ -0,0 +1,30 @@ +/* + * kobject.h - generic kernel object infrastructure. + * + */ + +#ifndef _KOBJECT_H_ +#define _KOBJECT_H_ + +#include <linux/types.h> +#include <linux/list.h> +#include <linux/sysfs.h> +#include <asm/atomic.h> + +struct kobject { + char name[16]; + atomic_t refcount; + struct list_head entry; + struct kobject * parent; + struct sysfs_dir dir; +}; + +extern void kobject_init(struct kobject *); + +extern int kobject_register(struct kobject *); +extern void kobject_unregister(struct kobject *); + +extern struct kobject * kobject_get(struct kobject *); +extern void kobject_put(struct kobject *); + +#endif /* _KOBJECT_H_ */ diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 6479902e1d20..fe82dff179ce 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -11,18 +11,15 @@ struct driver_dir_entry; struct attribute; +struct kobject; struct sysfs_ops { - int (*open)(struct driver_dir_entry *); - int (*close)(struct driver_dir_entry *); - ssize_t (*show)(struct driver_dir_entry *, struct attribute *,char *, size_t, loff_t); - ssize_t (*store)(struct driver_dir_entry *,struct attribute *,const char *, size_t, loff_t); + ssize_t (*show)(struct kobject *, struct attribute *,char *, size_t, loff_t); + ssize_t (*store)(struct kobject *,struct attribute *,const char *, size_t, loff_t); }; -struct driver_dir_entry { - char * name; +struct sysfs_dir { struct dentry * dentry; - mode_t mode; struct sysfs_ops * ops; }; @@ -32,20 +29,21 @@ struct attribute { }; extern int -sysfs_create_dir(struct driver_dir_entry *, struct driver_dir_entry *); +sysfs_create_dir(struct kobject *); extern void -sysfs_remove_dir(struct driver_dir_entry * entry); +sysfs_remove_dir(struct kobject *); extern int -sysfs_create_file(struct attribute * attr, - struct driver_dir_entry * parent); +sysfs_create_file(struct kobject *, struct attribute *); + +extern void +sysfs_remove_file(struct kobject *, struct attribute *); extern int -sysfs_create_symlink(struct driver_dir_entry * parent, - char * name, char * target); +sysfs_create_link(struct kobject * kobj, char * name, char * target); extern void -sysfs_remove_file(struct driver_dir_entry *, const char * name); +sysfs_remove_link(struct kobject *, char * name); #endif /* _SYSFS_H_ */ |
