Skip to content

Commit

Permalink
switch procfs to umode_t use
Browse files Browse the repository at this point in the history
both proc_dir_entry ->mode and populating functions

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Jan 4, 2012
1 parent 587a1f1 commit d161a13
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 32 deletions.
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/lparcfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ static const struct file_operations lparcfg_fops = {
static int __init lparcfg_init(void)
{
struct proc_dir_entry *ent;
mode_t mode = S_IRUSR | S_IRGRP | S_IROTH;
umode_t mode = S_IRUSR | S_IRGRP | S_IROTH;

/* Allow writing if we have FW_FEATURE_SPLPAR */
if (firmware_has_feature(FW_FEATURE_SPLPAR) &&
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ DECLARE_FILE_FUNCTIONS(alarm);

static const struct battery_file {
struct file_operations ops;
mode_t mode;
umode_t mode;
const char *name;
} acpi_battery_file[] = {
FILE_DESCRIPTION_RO(info),
Expand Down
2 changes: 1 addition & 1 deletion drivers/message/i2o/i2o_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
/* Structure used to define /proc entries */
typedef struct _i2o_proc_entry_t {
char *name; /* entry name */
mode_t mode; /* mode */
umode_t mode; /* mode */
const struct file_operations *fops; /* open function */
} i2o_proc_entry;

Expand Down
2 changes: 1 addition & 1 deletion drivers/misc/sgi-gru/gruprocfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ static const struct file_operations gru_fops = {

static struct proc_entry {
char *name;
int mode;
umode_t mode;
const struct file_operations *fops;
struct proc_dir_entry *entry;
} proc_files[] = {
Expand Down
4 changes: 2 additions & 2 deletions drivers/platform/x86/asus_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ static const struct file_operations disp_proc_fops = {
};

static int
asus_proc_add(char *name, const struct file_operations *proc_fops, mode_t mode,
asus_proc_add(char *name, const struct file_operations *proc_fops, umode_t mode,
struct acpi_device *device)
{
struct proc_dir_entry *proc;
Expand All @@ -1072,7 +1072,7 @@ asus_proc_add(char *name, const struct file_operations *proc_fops, mode_t mode,
static int asus_hotk_add_fs(struct acpi_device *device)
{
struct proc_dir_entry *proc;
mode_t mode;
umode_t mode;

if ((asus_uid == 0) && (asus_gid == 0)) {
mode = S_IFREG | S_IRUGO | S_IWUSR | S_IWGRP;
Expand Down
4 changes: 2 additions & 2 deletions drivers/platform/x86/thinkpad_acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ struct ibm_init_struct {
char param[32];

int (*init) (struct ibm_init_struct *);
mode_t base_procfs_mode;
umode_t base_procfs_mode;
struct ibm_struct *data;
};

Expand Down Expand Up @@ -8542,7 +8542,7 @@ static int __init ibm_init(struct ibm_init_struct *iibm)
"%s installed\n", ibm->name);

if (ibm->read) {
mode_t mode = iibm->base_procfs_mode;
umode_t mode = iibm->base_procfs_mode;

if (!mode)
mode = S_IRUGO;
Expand Down
7 changes: 3 additions & 4 deletions drivers/scsi/sg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2325,16 +2325,15 @@ static struct sg_proc_leaf sg_proc_leaf_arr[] = {
static int
sg_proc_init(void)
{
int k, mask;
int num_leaves = ARRAY_SIZE(sg_proc_leaf_arr);
struct sg_proc_leaf * leaf;
int k;

sg_proc_sgp = proc_mkdir(sg_proc_sg_dirname, NULL);
if (!sg_proc_sgp)
return 1;
for (k = 0; k < num_leaves; ++k) {
leaf = &sg_proc_leaf_arr[k];
mask = leaf->fops->write ? S_IRUGO | S_IWUSR : S_IRUGO;
struct sg_proc_leaf *leaf = &sg_proc_leaf_arr[k];
umode_t mask = leaf->fops->write ? S_IRUGO | S_IWUSR : S_IRUGO;
proc_create(leaf->name, mask, sg_proc_sgp, leaf->fops);
}
return 0;
Expand Down
2 changes: 1 addition & 1 deletion fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
struct pid_entry {
char *name;
int len;
mode_t mode;
umode_t mode;
const struct inode_operations *iop;
const struct file_operations *fop;
union proc_op op;
Expand Down
8 changes: 4 additions & 4 deletions fs/proc/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ static int proc_register(struct proc_dir_entry * dir, struct proc_dir_entry * dp

static struct proc_dir_entry *__proc_create(struct proc_dir_entry **parent,
const char *name,
mode_t mode,
umode_t mode,
nlink_t nlink)
{
struct proc_dir_entry *ent = NULL;
Expand Down Expand Up @@ -659,7 +659,7 @@ struct proc_dir_entry *proc_symlink(const char *name,
}
EXPORT_SYMBOL(proc_symlink);

struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode,
struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
struct proc_dir_entry *parent)
{
struct proc_dir_entry *ent;
Expand Down Expand Up @@ -699,7 +699,7 @@ struct proc_dir_entry *proc_mkdir(const char *name,
}
EXPORT_SYMBOL(proc_mkdir);

struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
struct proc_dir_entry *create_proc_entry(const char *name, umode_t mode,
struct proc_dir_entry *parent)
{
struct proc_dir_entry *ent;
Expand Down Expand Up @@ -728,7 +728,7 @@ struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
}
EXPORT_SYMBOL(create_proc_entry);

struct proc_dir_entry *proc_create_data(const char *name, mode_t mode,
struct proc_dir_entry *proc_create_data(const char *name, umode_t mode,
struct proc_dir_entry *parent,
const struct file_operations *proc_fops,
void *data)
Expand Down
2 changes: 1 addition & 1 deletion fs/proc/proc_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ const struct file_operations proc_net_operations = {


struct proc_dir_entry *proc_net_fops_create(struct net *net,
const char *name, mode_t mode, const struct file_operations *fops)
const char *name, umode_t mode, const struct file_operations *fops)
{
return proc_create(name, mode, net->proc_net, fops);
}
Expand Down
2 changes: 1 addition & 1 deletion include/linux/ide.h
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ __IDE_PROC_DEVSET(_name, _min, _max, NULL, NULL)

typedef struct {
const char *name;
mode_t mode;
umode_t mode;
const struct file_operations *proc_fops;
} ide_proc_entry_t;

Expand Down
24 changes: 12 additions & 12 deletions include/linux/proc_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ typedef int (write_proc_t)(struct file *file, const char __user *buffer,

struct proc_dir_entry {
unsigned int low_ino;
mode_t mode;
umode_t mode;
nlink_t nlink;
uid_t uid;
gid_t gid;
Expand Down Expand Up @@ -106,9 +106,9 @@ extern void proc_root_init(void);

void proc_flush_task(struct task_struct *task);

extern struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
extern struct proc_dir_entry *create_proc_entry(const char *name, umode_t mode,
struct proc_dir_entry *parent);
struct proc_dir_entry *proc_create_data(const char *name, mode_t mode,
struct proc_dir_entry *proc_create_data(const char *name, umode_t mode,
struct proc_dir_entry *parent,
const struct file_operations *proc_fops,
void *data);
Expand Down Expand Up @@ -146,17 +146,17 @@ extern void proc_device_tree_update_prop(struct proc_dir_entry *pde,
extern struct proc_dir_entry *proc_symlink(const char *,
struct proc_dir_entry *, const char *);
extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *);
extern struct proc_dir_entry *proc_mkdir_mode(const char *name, mode_t mode,
extern struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
struct proc_dir_entry *parent);

static inline struct proc_dir_entry *proc_create(const char *name, mode_t mode,
static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode,
struct proc_dir_entry *parent, const struct file_operations *proc_fops)
{
return proc_create_data(name, mode, parent, proc_fops, NULL);
}

static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
mode_t mode, struct proc_dir_entry *base,
umode_t mode, struct proc_dir_entry *base,
read_proc_t *read_proc, void * data)
{
struct proc_dir_entry *res=create_proc_entry(name,mode,base);
Expand All @@ -168,7 +168,7 @@ static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
}

extern struct proc_dir_entry *proc_net_fops_create(struct net *net,
const char *name, mode_t mode, const struct file_operations *fops);
const char *name, umode_t mode, const struct file_operations *fops);
extern void proc_net_remove(struct net *net, const char *name);
extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
struct proc_dir_entry *parent);
Expand All @@ -185,15 +185,15 @@ static inline void proc_flush_task(struct task_struct *task)
}

static inline struct proc_dir_entry *create_proc_entry(const char *name,
mode_t mode, struct proc_dir_entry *parent) { return NULL; }
umode_t mode, struct proc_dir_entry *parent) { return NULL; }
static inline struct proc_dir_entry *proc_create(const char *name,
mode_t mode, struct proc_dir_entry *parent,
umode_t mode, struct proc_dir_entry *parent,
const struct file_operations *proc_fops)
{
return NULL;
}
static inline struct proc_dir_entry *proc_create_data(const char *name,
mode_t mode, struct proc_dir_entry *parent,
umode_t mode, struct proc_dir_entry *parent,
const struct file_operations *proc_fops, void *data)
{
return NULL;
Expand All @@ -205,10 +205,10 @@ static inline struct proc_dir_entry *proc_symlink(const char *name,
static inline struct proc_dir_entry *proc_mkdir(const char *name,
struct proc_dir_entry *parent) {return NULL;}
static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
mode_t mode, struct proc_dir_entry *parent) { return NULL; }
umode_t mode, struct proc_dir_entry *parent) { return NULL; }

static inline struct proc_dir_entry *create_proc_read_entry(const char *name,
mode_t mode, struct proc_dir_entry *base,
umode_t mode, struct proc_dir_entry *base,
read_proc_t *read_proc, void * data) { return NULL; }

struct tty_driver;
Expand Down
2 changes: 1 addition & 1 deletion include/sound/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ struct snd_info_entry_ops {

struct snd_info_entry {
const char *name;
mode_t mode;
umode_t mode;
long size;
unsigned short content;
union {
Expand Down

0 comments on commit d161a13

Please sign in to comment.