]> git.hungrycats.org Git - linux/commitdiff
driverfs: Change the name of struct driver_file_entry to struct device_attribute
authorPatrick Mochel <mochel@osdl.org>
Tue, 30 Jul 2002 13:43:13 +0000 (06:43 -0700)
committerPatrick Mochel <mochel@osdl.org>
Tue, 30 Jul 2002 13:43:13 +0000 (06:43 -0700)
It may seem gratuitous, but it's what we really want.

driverfs files are meant to expose attributes of various kernel objects, so in that sense,
the change adds more accurate meaning to the object.

Plus, we will soon gain the ability to expose attributes of drivers (both device and bus)
themselves, and we want to be able to have each mean something reasonable.

This changes driverfs and the device model core (but none of the other users)

drivers/base/fs.c
drivers/base/interface.c
fs/driverfs/inode.c
include/linux/device.h
include/linux/driverfs_fs.h

index 1429392c1533341392f6b097708482cc89667554..0df919e7f0825b3c43dc8dcf7dcb02eae0924328 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/stat.h>
 #include <linux/limits.h>
 
-extern struct driver_file_entry * device_default_files[];
+extern struct device_attribute * device_default_files[];
 
 /**
  * device_create_file - create a driverfs file for a device
@@ -24,7 +24,7 @@ extern struct driver_file_entry * device_default_files[];
  *
  * Allocate space for file entry, copy descriptor, and create.
  */
-int device_create_file(struct device * dev, struct driver_file_entry * entry)
+int device_create_file(struct device * dev, struct device_attribute * entry)
 {
        int error = -EINVAL;
 
@@ -148,7 +148,7 @@ int device_create_dir(struct driver_dir_entry * dir, struct driver_dir_entry * p
 int device_make_dir(struct device * dev)
 {
        struct driver_dir_entry * parent = NULL;
-       struct driver_file_entry * entry;
+       struct device_attribute * entry;
        int error;
        int i;
 
index 5d03984a273fd84d562739738a127ae2c38c7992..d1c8ed10805524c750f1cc113c6ebacb9c3d0875 100644 (file)
@@ -14,7 +14,7 @@ static ssize_t device_read_name(struct device * dev, char * buf, size_t count, l
        return off ? 0 : sprintf(buf,"%s\n",dev->name);
 }
 
-static struct driver_file_entry device_name_entry = {
+static struct device_attribute device_name_entry = {
        name:   "name",
        mode:   S_IRUGO,
        show:   device_read_name,
@@ -89,14 +89,14 @@ device_write_power(struct device * dev, const char * buf, size_t count, loff_t o
        return error < 0 ? error : count;
 }
 
-static struct driver_file_entry device_power_entry = {
+static struct device_attribute device_power_entry = {
        name:           "power",
        mode:           S_IWUSR | S_IRUGO,
        show:           device_read_power,
        store:          device_write_power,
 };
 
-struct driver_file_entry * device_default_files[] = {
+struct device_attribute * device_default_files[] = {
        &device_name_entry,
        &device_power_entry,
        NULL,
index 08df41832bb133a939ed30b69c039c24910451ad..f533eb2c45ea0551a798d233f9cd3b2ddce9325c 100644 (file)
@@ -266,7 +266,7 @@ static int driverfs_rmdir(struct inode *dir, struct dentry *dentry)
  *
  * Userspace wants data from a file. It is up to the creator of the file to
  * provide that data.
- * There is a struct driver_file_entry embedded in file->private_data. We
+ * There is a struct device_attribute embedded in file->private_data. We
  * obtain that and check if the read callback is implemented. If so, we call
  * it, passing the data field of the file entry.
  * Said callback is responsible for filling the buffer and returning the number
@@ -275,14 +275,14 @@ static int driverfs_rmdir(struct inode *dir, struct dentry *dentry)
 static ssize_t
 driverfs_read_file(struct file *file, char *buf, size_t count, loff_t *ppos)
 {
-       struct driver_file_entry * entry;
+       struct device_attribute * entry;
        struct driver_dir_entry * dir;
        unsigned char *page;
        ssize_t retval = 0;
        struct device * dev;
 
        dir = file->f_dentry->d_parent->d_fsdata;
-       entry = (struct driver_file_entry *)file->f_dentry->d_fsdata;
+       entry = (struct device_attribute *)file->f_dentry->d_fsdata;
        if (!entry) {
                DBG("%s: file entry is NULL\n",__FUNCTION__);
                return -ENOENT;
@@ -341,7 +341,7 @@ driverfs_read_file(struct file *file, char *buf, size_t count, loff_t *ppos)
 static ssize_t
 driverfs_write_file(struct file *file, const char *buf, size_t count, loff_t *ppos)
 {
-       struct driver_file_entry * entry;
+       struct device_attribute * entry;
        struct driver_dir_entry * dir;
        struct device * dev;
        ssize_t retval = 0;
@@ -349,7 +349,7 @@ driverfs_write_file(struct file *file, const char *buf, size_t count, loff_t *pp
 
        dir = file->f_dentry->d_parent->d_fsdata;
 
-       entry = (struct driver_file_entry *)file->f_dentry->d_fsdata;
+       entry = (struct device_attribute *)file->f_dentry->d_fsdata;
        if (!entry) {
                DBG("%s: file entry is NULL\n",__FUNCTION__);
                return -ENOENT;
@@ -618,7 +618,7 @@ driverfs_create_dir(struct driver_dir_entry * entry,
  * @parent:    directory to create it in
  */
 int
-driverfs_create_file(struct driver_file_entry * entry,
+driverfs_create_file(struct device_attribute * entry,
                     struct driver_dir_entry * parent)
 {
        struct dentry * dentry;
index a6d10931ae7f43ce76cf1da2ed81f074ca2afae2..38048776fdd8773dcd19be3e63fe101ac95158cf 100644 (file)
@@ -179,7 +179,7 @@ g_list_to_dev(struct list_head *g_list)
  */
 extern int device_register(struct device * dev);
 
-extern int device_create_file(struct device *device, struct driver_file_entry * entry);
+extern int device_create_file(struct device *device, struct device_attribute * entry);
 extern void device_remove_file(struct device * dev, const char * name);
 
 /*
index 758dc23f09f66f8d4190c886be645bbf930ff649..dceb539d91dcf2ab37581328eb5ce3399a32cd0a 100644 (file)
@@ -34,7 +34,7 @@ struct driver_dir_entry {
 
 struct device;
 
-struct driver_file_entry {
+struct device_attribute {
        char                    * name;
        mode_t                  mode;
 
@@ -49,7 +49,7 @@ extern void
 driverfs_remove_dir(struct driver_dir_entry * entry);
 
 extern int
-driverfs_create_file(struct driver_file_entry * entry,
+driverfs_create_file(struct device_attribute * entry,
                     struct driver_dir_entry * parent);
 
 extern int