Commit 3ffe04d8 authored by Patrick Mochel's avatar Patrick Mochel

driverfs: Change the name of struct driver_file_entry to struct device_attribute

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)
parent a9ae3e34
......@@ -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;
......
......@@ -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,
......
......@@ -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;
......
......@@ -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);
/*
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment