Commit 24e56f5e authored by Patrick Mochel's avatar Patrick Mochel

[sysfs] Mark some arguments const.

From Stephen Hemminger
parent e6289147
...@@ -22,7 +22,7 @@ static int init_dir(struct inode * inode) ...@@ -22,7 +22,7 @@ static int init_dir(struct inode * inode)
static struct dentry * static struct dentry *
create_dir(struct kobject * k, struct dentry * p, char * n) create_dir(struct kobject * k, struct dentry * p, const char * n)
{ {
struct dentry * dentry; struct dentry * dentry;
...@@ -47,7 +47,7 @@ create_dir(struct kobject * k, struct dentry * p, char * n) ...@@ -47,7 +47,7 @@ create_dir(struct kobject * k, struct dentry * p, char * n)
} }
struct dentry * sysfs_create_subdir(struct kobject * k, char * n) struct dentry * sysfs_create_subdir(struct kobject * k, const char * n)
{ {
return create_dir(k,k->dentry,n); return create_dir(k,k->dentry,n);
} }
...@@ -155,7 +155,7 @@ void sysfs_remove_dir(struct kobject * kobj) ...@@ -155,7 +155,7 @@ void sysfs_remove_dir(struct kobject * kobj)
dput(dentry); dput(dentry);
} }
void sysfs_rename_dir(struct kobject * kobj, char *new_name) void sysfs_rename_dir(struct kobject * kobj, const char *new_name)
{ {
struct dentry * new_dentry, * parent; struct dentry * new_dentry, * parent;
......
...@@ -345,7 +345,7 @@ static struct file_operations sysfs_file_operations = { ...@@ -345,7 +345,7 @@ static struct file_operations sysfs_file_operations = {
}; };
int sysfs_add_file(struct dentry * dir, struct attribute * attr) int sysfs_add_file(struct dentry * dir, const struct attribute * attr)
{ {
struct dentry * dentry; struct dentry * dentry;
int error; int error;
...@@ -368,7 +368,7 @@ int sysfs_add_file(struct dentry * dir, struct attribute * attr) ...@@ -368,7 +368,7 @@ int sysfs_add_file(struct dentry * dir, struct attribute * attr)
* @attr: atrribute descriptor. * @attr: atrribute descriptor.
*/ */
int sysfs_create_file(struct kobject * kobj, struct attribute * attr) int sysfs_create_file(struct kobject * kobj, const struct attribute * attr)
{ {
if (kobj && attr) if (kobj && attr)
return sysfs_add_file(kobj->dentry,attr); return sysfs_add_file(kobj->dentry,attr);
...@@ -384,7 +384,7 @@ int sysfs_create_file(struct kobject * kobj, struct attribute * attr) ...@@ -384,7 +384,7 @@ int sysfs_create_file(struct kobject * kobj, struct attribute * attr)
* Also call dnotify for the dentry, which lots of userspace programs * Also call dnotify for the dentry, which lots of userspace programs
* use. * use.
*/ */
int sysfs_update_file(struct kobject * kobj, struct attribute * attr) int sysfs_update_file(struct kobject * kobj, const struct attribute * attr)
{ {
struct dentry * dir = kobj->dentry; struct dentry * dir = kobj->dentry;
struct dentry * victim; struct dentry * victim;
...@@ -425,7 +425,7 @@ int sysfs_update_file(struct kobject * kobj, struct attribute * attr) ...@@ -425,7 +425,7 @@ int sysfs_update_file(struct kobject * kobj, struct attribute * attr)
* Hash the attribute name and kill the victim. * Hash the attribute name and kill the victim.
*/ */
void sysfs_remove_file(struct kobject * kobj, struct attribute * attr) void sysfs_remove_file(struct kobject * kobj, const struct attribute * attr)
{ {
sysfs_hash_and_remove(kobj->dentry,attr->name); sysfs_hash_and_remove(kobj->dentry,attr->name);
} }
......
...@@ -15,18 +15,19 @@ ...@@ -15,18 +15,19 @@
#include "sysfs.h" #include "sysfs.h"
static void remove_files(struct dentry * dir, struct attribute_group * grp) static void remove_files(struct dentry * dir,
const struct attribute_group * grp)
{ {
struct attribute ** attr; struct attribute *const* attr;
for (attr = grp->attrs; *attr; attr++) for (attr = grp->attrs; *attr; attr++)
sysfs_hash_and_remove(dir,(*attr)->name); sysfs_hash_and_remove(dir,(*attr)->name);
} }
static int create_files(struct dentry * dir, static int create_files(struct dentry * dir,
struct attribute_group * grp) const struct attribute_group * grp)
{ {
struct attribute ** attr; struct attribute *const* attr;
int error = 0; int error = 0;
for (attr = grp->attrs; *attr && !error; attr++) { for (attr = grp->attrs; *attr && !error; attr++) {
...@@ -38,7 +39,8 @@ static int create_files(struct dentry * dir, ...@@ -38,7 +39,8 @@ static int create_files(struct dentry * dir,
} }
int sysfs_create_group(struct kobject * kobj, struct attribute_group * grp) int sysfs_create_group(struct kobject * kobj,
const struct attribute_group * grp)
{ {
struct dentry * dir; struct dentry * dir;
int error; int error;
...@@ -58,7 +60,8 @@ int sysfs_create_group(struct kobject * kobj, struct attribute_group * grp) ...@@ -58,7 +60,8 @@ int sysfs_create_group(struct kobject * kobj, struct attribute_group * grp)
return error; return error;
} }
void sysfs_remove_group(struct kobject * kobj, struct attribute_group * grp) void sysfs_remove_group(struct kobject * kobj,
const struct attribute_group * grp)
{ {
struct dentry * dir; struct dentry * dir;
......
...@@ -4,10 +4,10 @@ extern struct vfsmount * sysfs_mount; ...@@ -4,10 +4,10 @@ extern struct vfsmount * sysfs_mount;
extern struct inode * sysfs_new_inode(mode_t mode); extern struct inode * sysfs_new_inode(mode_t mode);
extern int sysfs_create(struct dentry *, int mode, int (*init)(struct inode *)); extern int sysfs_create(struct dentry *, int mode, int (*init)(struct inode *));
extern struct dentry * sysfs_get_dentry(struct dentry *, char *); extern struct dentry * sysfs_get_dentry(struct dentry *, const char *);
extern int sysfs_add_file(struct dentry * dir, struct attribute * attr); extern int sysfs_add_file(struct dentry * dir, const struct attribute * attr);
extern void sysfs_hash_and_remove(struct dentry * dir, const char * name); extern void sysfs_hash_and_remove(struct dentry * dir, const char * name);
extern struct dentry * sysfs_create_subdir(struct kobject *, char *); extern struct dentry * sysfs_create_subdir(struct kobject *, const char *);
extern void sysfs_remove_subdir(struct dentry *); extern void sysfs_remove_subdir(struct dentry *);
...@@ -40,16 +40,16 @@ extern void ...@@ -40,16 +40,16 @@ extern void
sysfs_remove_dir(struct kobject *); sysfs_remove_dir(struct kobject *);
extern void extern void
sysfs_rename_dir(struct kobject *, char *new_name); sysfs_rename_dir(struct kobject *, const char *new_name);
extern int extern int
sysfs_create_file(struct kobject *, struct attribute *); sysfs_create_file(struct kobject *, const struct attribute *);
extern int extern int
sysfs_update_file(struct kobject *, struct attribute *); sysfs_update_file(struct kobject *, const struct attribute *);
extern void extern void
sysfs_remove_file(struct kobject *, struct attribute *); sysfs_remove_file(struct kobject *, const struct attribute *);
extern int extern int
sysfs_create_link(struct kobject * kobj, struct kobject * target, char * name); sysfs_create_link(struct kobject * kobj, struct kobject * target, char * name);
...@@ -63,7 +63,7 @@ struct attribute_group { ...@@ -63,7 +63,7 @@ struct attribute_group {
struct attribute ** attrs; struct attribute ** attrs;
}; };
int sysfs_create_group(struct kobject *, struct attribute_group *); int sysfs_create_group(struct kobject *, const struct attribute_group *);
void sysfs_remove_group(struct kobject *, struct attribute_group *); void sysfs_remove_group(struct kobject *, const struct attribute_group *);
#endif /* _SYSFS_H_ */ #endif /* _SYSFS_H_ */
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