Skip to content

Commit

Permalink
net: Use octal not symbolic permissions
Browse files Browse the repository at this point in the history
Prefer the direct use of octal for permissions.

Done with checkpatch -f --types=SYMBOLIC_PERMS --fix-inplace
and some typing.

Miscellanea:

o Whitespace neatening around these conversions.

Signed-off-by: Joe Perches <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
JoePerches authored and davem330 committed Mar 26, 2018
1 parent cb6219a commit d644406
Show file tree
Hide file tree
Showing 63 changed files with 161 additions and 161 deletions.
6 changes: 3 additions & 3 deletions net/8021q/vlanproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ int __net_init vlan_proc_init(struct net *net)
if (!vn->proc_vlan_dir)
goto err;

vn->proc_vlan_conf = proc_create(name_conf, S_IFREG|S_IRUSR|S_IWUSR,
vn->proc_vlan_dir, &vlan_fops);
vn->proc_vlan_conf = proc_create(name_conf, S_IFREG | 0600,
vn->proc_vlan_dir, &vlan_fops);
if (!vn->proc_vlan_conf)
goto err;
return 0;
Expand All @@ -172,7 +172,7 @@ int vlan_proc_add_dev(struct net_device *vlandev)
if (!strcmp(vlandev->name, name_conf))
return -EINVAL;
vlan->dent =
proc_create_data(vlandev->name, S_IFREG|S_IRUSR|S_IWUSR,
proc_create_data(vlandev->name, S_IFREG | 0600,
vn->proc_vlan_dir, &vlandev_fops, vlandev);
if (!vlan->dent)
return -ENOBUFS;
Expand Down
8 changes: 4 additions & 4 deletions net/appletalk/atalk_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -257,22 +257,22 @@ int __init atalk_proc_init(void)
if (!atalk_proc_dir)
goto out;

p = proc_create("interface", S_IRUGO, atalk_proc_dir,
p = proc_create("interface", 0444, atalk_proc_dir,
&atalk_seq_interface_fops);
if (!p)
goto out_interface;

p = proc_create("route", S_IRUGO, atalk_proc_dir,
p = proc_create("route", 0444, atalk_proc_dir,
&atalk_seq_route_fops);
if (!p)
goto out_route;

p = proc_create("socket", S_IRUGO, atalk_proc_dir,
p = proc_create("socket", 0444, atalk_proc_dir,
&atalk_seq_socket_fops);
if (!p)
goto out_socket;

p = proc_create("arp", S_IRUGO, atalk_proc_dir, &atalk_seq_arp_fops);
p = proc_create("arp", 0444, atalk_proc_dir, &atalk_seq_arp_fops);
if (!p)
goto out_arp;

Expand Down
12 changes: 6 additions & 6 deletions net/atm/atm_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ static ssize_t show_link_rate(struct device *cdev,
return scnprintf(buf, PAGE_SIZE, "%d\n", link_rate);
}

static DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
static DEVICE_ATTR(atmaddress, S_IRUGO, show_atmaddress, NULL);
static DEVICE_ATTR(atmindex, S_IRUGO, show_atmindex, NULL);
static DEVICE_ATTR(carrier, S_IRUGO, show_carrier, NULL);
static DEVICE_ATTR(type, S_IRUGO, show_type, NULL);
static DEVICE_ATTR(link_rate, S_IRUGO, show_link_rate, NULL);
static DEVICE_ATTR(address, 0444, show_address, NULL);
static DEVICE_ATTR(atmaddress, 0444, show_atmaddress, NULL);
static DEVICE_ATTR(atmindex, 0444, show_atmindex, NULL);
static DEVICE_ATTR(carrier, 0444, show_carrier, NULL);
static DEVICE_ATTR(type, 0444, show_type, NULL);
static DEVICE_ATTR(link_rate, 0444, show_link_rate, NULL);

static struct device_attribute *atm_attrs[] = {
&dev_attr_atmaddress,
Expand Down
2 changes: 1 addition & 1 deletion net/atm/clip.c
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ static int __init atm_clip_init(void)
{
struct proc_dir_entry *p;

p = proc_create("arp", S_IRUGO, atm_proc_root, &arp_seq_fops);
p = proc_create("arp", 0444, atm_proc_root, &arp_seq_fops);
if (!p) {
pr_err("Unable to initialize /proc/net/atm/arp\n");
atm_clip_exit_noproc();
Expand Down
2 changes: 1 addition & 1 deletion net/atm/lec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ static int __init lane_module_init(void)
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *p;

p = proc_create("lec", S_IRUGO, atm_proc_root, &lec_seq_fops);
p = proc_create("lec", 0444, atm_proc_root, &lec_seq_fops);
if (!p) {
pr_err("Unable to initialize /proc/net/atm/lec\n");
return -ENOMEM;
Expand Down
2 changes: 1 addition & 1 deletion net/atm/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ int __init atm_proc_init(void)
for (e = atm_proc_ents; e->name; e++) {
struct proc_dir_entry *dirent;

dirent = proc_create(e->name, S_IRUGO,
dirent = proc_create(e->name, 0444,
atm_proc_root, e->proc_fops);
if (!dirent)
goto err_out_remove;
Expand Down
6 changes: 3 additions & 3 deletions net/ax25/af_ax25.c
Original file line number Diff line number Diff line change
Expand Up @@ -1989,10 +1989,10 @@ static int __init ax25_init(void)
dev_add_pack(&ax25_packet_type);
register_netdevice_notifier(&ax25_dev_notifier);

proc_create("ax25_route", S_IRUGO, init_net.proc_net,
proc_create("ax25_route", 0444, init_net.proc_net,
&ax25_route_fops);
proc_create("ax25", S_IRUGO, init_net.proc_net, &ax25_info_fops);
proc_create("ax25_calls", S_IRUGO, init_net.proc_net, &ax25_uid_fops);
proc_create("ax25", 0444, init_net.proc_net, &ax25_info_fops);
proc_create("ax25_calls", 0444, init_net.proc_net, &ax25_uid_fops);
out:
return rc;
}
Expand Down
4 changes: 2 additions & 2 deletions net/bluetooth/rfcomm/tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ static ssize_t show_channel(struct device *tty_dev, struct device_attribute *att
return sprintf(buf, "%d\n", dev->channel);
}

static DEVICE_ATTR(address, S_IRUGO, show_address, NULL);
static DEVICE_ATTR(channel, S_IRUGO, show_channel, NULL);
static DEVICE_ATTR(address, 0444, show_address, NULL);
static DEVICE_ATTR(channel, 0444, show_channel, NULL);

static struct rfcomm_dev *__rfcomm_dev_add(struct rfcomm_dev_req *req,
struct rfcomm_dlc *dlc)
Expand Down
2 changes: 1 addition & 1 deletion net/bridge/br_sysfs_br.c
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ static ssize_t brforward_read(struct file *filp, struct kobject *kobj,

static struct bin_attribute bridge_forward = {
.attr = { .name = SYSFS_BRIDGE_FDB,
.mode = S_IRUGO, },
.mode = 0444, },
.read = brforward_read,
};

Expand Down
36 changes: 18 additions & 18 deletions net/bridge/br_sysfs_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static int store_##_name(struct net_bridge_port *p, unsigned long v) \
{ \
return store_flag(p, v, _mask); \
} \
static BRPORT_ATTR(_name, S_IRUGO | S_IWUSR, \
static BRPORT_ATTR(_name, 0644, \
show_##_name, store_##_name)

static int store_flag(struct net_bridge_port *p, unsigned long v,
Expand All @@ -71,99 +71,99 @@ static ssize_t show_path_cost(struct net_bridge_port *p, char *buf)
return sprintf(buf, "%d\n", p->path_cost);
}

static BRPORT_ATTR(path_cost, S_IRUGO | S_IWUSR,
static BRPORT_ATTR(path_cost, 0644,
show_path_cost, br_stp_set_path_cost);

static ssize_t show_priority(struct net_bridge_port *p, char *buf)
{
return sprintf(buf, "%d\n", p->priority);
}

static BRPORT_ATTR(priority, S_IRUGO | S_IWUSR,
static BRPORT_ATTR(priority, 0644,
show_priority, br_stp_set_port_priority);

static ssize_t show_designated_root(struct net_bridge_port *p, char *buf)
{
return br_show_bridge_id(buf, &p->designated_root);
}
static BRPORT_ATTR(designated_root, S_IRUGO, show_designated_root, NULL);
static BRPORT_ATTR(designated_root, 0444, show_designated_root, NULL);

static ssize_t show_designated_bridge(struct net_bridge_port *p, char *buf)
{
return br_show_bridge_id(buf, &p->designated_bridge);
}
static BRPORT_ATTR(designated_bridge, S_IRUGO, show_designated_bridge, NULL);
static BRPORT_ATTR(designated_bridge, 0444, show_designated_bridge, NULL);

static ssize_t show_designated_port(struct net_bridge_port *p, char *buf)
{
return sprintf(buf, "%d\n", p->designated_port);
}
static BRPORT_ATTR(designated_port, S_IRUGO, show_designated_port, NULL);
static BRPORT_ATTR(designated_port, 0444, show_designated_port, NULL);

static ssize_t show_designated_cost(struct net_bridge_port *p, char *buf)
{
return sprintf(buf, "%d\n", p->designated_cost);
}
static BRPORT_ATTR(designated_cost, S_IRUGO, show_designated_cost, NULL);
static BRPORT_ATTR(designated_cost, 0444, show_designated_cost, NULL);

static ssize_t show_port_id(struct net_bridge_port *p, char *buf)
{
return sprintf(buf, "0x%x\n", p->port_id);
}
static BRPORT_ATTR(port_id, S_IRUGO, show_port_id, NULL);
static BRPORT_ATTR(port_id, 0444, show_port_id, NULL);

static ssize_t show_port_no(struct net_bridge_port *p, char *buf)
{
return sprintf(buf, "0x%x\n", p->port_no);
}

static BRPORT_ATTR(port_no, S_IRUGO, show_port_no, NULL);
static BRPORT_ATTR(port_no, 0444, show_port_no, NULL);

static ssize_t show_change_ack(struct net_bridge_port *p, char *buf)
{
return sprintf(buf, "%d\n", p->topology_change_ack);
}
static BRPORT_ATTR(change_ack, S_IRUGO, show_change_ack, NULL);
static BRPORT_ATTR(change_ack, 0444, show_change_ack, NULL);

static ssize_t show_config_pending(struct net_bridge_port *p, char *buf)
{
return sprintf(buf, "%d\n", p->config_pending);
}
static BRPORT_ATTR(config_pending, S_IRUGO, show_config_pending, NULL);
static BRPORT_ATTR(config_pending, 0444, show_config_pending, NULL);

static ssize_t show_port_state(struct net_bridge_port *p, char *buf)
{
return sprintf(buf, "%d\n", p->state);
}
static BRPORT_ATTR(state, S_IRUGO, show_port_state, NULL);
static BRPORT_ATTR(state, 0444, show_port_state, NULL);

static ssize_t show_message_age_timer(struct net_bridge_port *p,
char *buf)
{
return sprintf(buf, "%ld\n", br_timer_value(&p->message_age_timer));
}
static BRPORT_ATTR(message_age_timer, S_IRUGO, show_message_age_timer, NULL);
static BRPORT_ATTR(message_age_timer, 0444, show_message_age_timer, NULL);

static ssize_t show_forward_delay_timer(struct net_bridge_port *p,
char *buf)
{
return sprintf(buf, "%ld\n", br_timer_value(&p->forward_delay_timer));
}
static BRPORT_ATTR(forward_delay_timer, S_IRUGO, show_forward_delay_timer, NULL);
static BRPORT_ATTR(forward_delay_timer, 0444, show_forward_delay_timer, NULL);

static ssize_t show_hold_timer(struct net_bridge_port *p,
char *buf)
{
return sprintf(buf, "%ld\n", br_timer_value(&p->hold_timer));
}
static BRPORT_ATTR(hold_timer, S_IRUGO, show_hold_timer, NULL);
static BRPORT_ATTR(hold_timer, 0444, show_hold_timer, NULL);

static int store_flush(struct net_bridge_port *p, unsigned long v)
{
br_fdb_delete_by_port(p->br, p, 0, 0); // Don't delete local entry
return 0;
}
static BRPORT_ATTR(flush, S_IWUSR, NULL, store_flush);
static BRPORT_ATTR(flush, 0200, NULL, store_flush);

static ssize_t show_group_fwd_mask(struct net_bridge_port *p, char *buf)
{
Expand All @@ -179,7 +179,7 @@ static int store_group_fwd_mask(struct net_bridge_port *p,

return 0;
}
static BRPORT_ATTR(group_fwd_mask, S_IRUGO | S_IWUSR, show_group_fwd_mask,
static BRPORT_ATTR(group_fwd_mask, 0644, show_group_fwd_mask,
store_group_fwd_mask);

BRPORT_ATTR_FLAG(hairpin_mode, BR_HAIRPIN_MODE);
Expand All @@ -204,7 +204,7 @@ static int store_multicast_router(struct net_bridge_port *p,
{
return br_multicast_set_port_router(p, v);
}
static BRPORT_ATTR(multicast_router, S_IRUGO | S_IWUSR, show_multicast_router,
static BRPORT_ATTR(multicast_router, 0644, show_multicast_router,
store_multicast_router);

BRPORT_ATTR_FLAG(multicast_fast_leave, BR_MULTICAST_FAST_LEAVE);
Expand Down
2 changes: 1 addition & 1 deletion net/can/af_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ MODULE_AUTHOR("Urs Thuermann <[email protected]>, "
MODULE_ALIAS_NETPROTO(PF_CAN);

static int stats_timer __read_mostly = 1;
module_param(stats_timer, int, S_IRUGO);
module_param(stats_timer, int, 0444);
MODULE_PARM_DESC(stats_timer, "enable timer for statistics (default:on)");

static struct kmem_cache *rcv_cache __read_mostly;
Expand Down
2 changes: 1 addition & 1 deletion net/can/gw.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ MODULE_ALIAS(CAN_GW_NAME);
#define CGW_DEFAULT_HOPS 1

static unsigned int max_hops __read_mostly = CGW_DEFAULT_HOPS;
module_param(max_hops, uint, S_IRUGO);
module_param(max_hops, uint, 0444);
MODULE_PARM_DESC(max_hops,
"maximum " CAN_GW_NAME " routing hops for CAN frames "
"(valid values: " __stringify(CGW_MIN_HOPS) "-"
Expand Down
2 changes: 1 addition & 1 deletion net/ceph/ceph_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static const struct kernel_param_ops param_ops_supported_features = {
.get = param_get_supported_features,
};
module_param_cb(supported_features, &param_ops_supported_features, NULL,
S_IRUGO);
0444);

const char *ceph_msg_type_name(int type)
{
Expand Down
6 changes: 3 additions & 3 deletions net/core/net-procfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,12 @@ static int __net_init dev_proc_net_init(struct net *net)
{
int rc = -ENOMEM;

if (!proc_create("dev", S_IRUGO, net->proc_net, &dev_seq_fops))
if (!proc_create("dev", 0444, net->proc_net, &dev_seq_fops))
goto out;
if (!proc_create("softnet_stat", S_IRUGO, net->proc_net,
if (!proc_create("softnet_stat", 0444, net->proc_net,
&softnet_seq_fops))
goto out_dev;
if (!proc_create("ptype", S_IRUGO, net->proc_net, &ptype_seq_fops))
if (!proc_create("ptype", 0444, net->proc_net, &ptype_seq_fops))
goto out_softnet;

if (wext_proc_init(net))
Expand Down
12 changes: 6 additions & 6 deletions net/core/net-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ static ssize_t group_store(struct device *dev, struct device_attribute *attr,
return netdev_store(dev, attr, buf, len, change_group);
}
NETDEVICE_SHOW(group, fmt_dec);
static DEVICE_ATTR(netdev_group, S_IRUGO | S_IWUSR, group_show, group_store);
static DEVICE_ATTR(netdev_group, 0644, group_show, group_store);

static int change_proto_down(struct net_device *dev, unsigned long proto_down)
{
Expand Down Expand Up @@ -854,10 +854,10 @@ static ssize_t store_rps_dev_flow_table_cnt(struct netdev_rx_queue *queue,
}

static struct rx_queue_attribute rps_cpus_attribute __ro_after_init
= __ATTR(rps_cpus, S_IRUGO | S_IWUSR, show_rps_map, store_rps_map);
= __ATTR(rps_cpus, 0644, show_rps_map, store_rps_map);

static struct rx_queue_attribute rps_dev_flow_table_cnt_attribute __ro_after_init
= __ATTR(rps_flow_cnt, S_IRUGO | S_IWUSR,
= __ATTR(rps_flow_cnt, 0644,
show_rps_dev_flow_table_cnt, store_rps_dev_flow_table_cnt);
#endif /* CONFIG_RPS */

Expand Down Expand Up @@ -1154,7 +1154,7 @@ static ssize_t bql_set_hold_time(struct netdev_queue *queue,
}

static struct netdev_queue_attribute bql_hold_time_attribute __ro_after_init
= __ATTR(hold_time, S_IRUGO | S_IWUSR,
= __ATTR(hold_time, 0644,
bql_show_hold_time, bql_set_hold_time);

static ssize_t bql_show_inflight(struct netdev_queue *queue,
Expand All @@ -1166,7 +1166,7 @@ static ssize_t bql_show_inflight(struct netdev_queue *queue,
}

static struct netdev_queue_attribute bql_inflight_attribute __ro_after_init =
__ATTR(inflight, S_IRUGO, bql_show_inflight, NULL);
__ATTR(inflight, 0444, bql_show_inflight, NULL);

#define BQL_ATTR(NAME, FIELD) \
static ssize_t bql_show_ ## NAME(struct netdev_queue *queue, \
Expand All @@ -1182,7 +1182,7 @@ static ssize_t bql_set_ ## NAME(struct netdev_queue *queue, \
} \
\
static struct netdev_queue_attribute bql_ ## NAME ## _attribute __ro_after_init \
= __ATTR(NAME, S_IRUGO | S_IWUSR, \
= __ATTR(NAME, 0644, \
bql_show_ ## NAME, bql_set_ ## NAME)

BQL_ATTR(limit, limit);
Expand Down
2 changes: 1 addition & 1 deletion net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -3455,7 +3455,7 @@ static const struct file_operations proto_seq_fops = {

static __net_init int proto_init_net(struct net *net)
{
if (!proc_create("protocols", S_IRUGO, net->proc_net, &proto_seq_fops))
if (!proc_create("protocols", 0444, net->proc_net, &proto_seq_fops))
return -ENOMEM;

return 0;
Expand Down
2 changes: 1 addition & 1 deletion net/decnet/af_decnet.c
Original file line number Diff line number Diff line change
Expand Up @@ -2383,7 +2383,7 @@ static int __init decnet_init(void)
dev_add_pack(&dn_dix_packet_type);
register_netdevice_notifier(&dn_dev_notifier);

proc_create("decnet", S_IRUGO, init_net.proc_net, &dn_socket_seq_fops);
proc_create("decnet", 0444, init_net.proc_net, &dn_socket_seq_fops);
dn_register_sysctl();
out:
return rc;
Expand Down
2 changes: 1 addition & 1 deletion net/decnet/dn_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1424,7 +1424,7 @@ void __init dn_dev_init(void)
rtnl_register_module(THIS_MODULE, PF_DECnet, RTM_GETADDR,
NULL, dn_nl_dump_ifaddr, 0);

proc_create("decnet_dev", S_IRUGO, init_net.proc_net, &dn_dev_seq_fops);
proc_create("decnet_dev", 0444, init_net.proc_net, &dn_dev_seq_fops);

#ifdef CONFIG_SYSCTL
{
Expand Down
2 changes: 1 addition & 1 deletion net/decnet/dn_neigh.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ static const struct file_operations dn_neigh_seq_fops = {
void __init dn_neigh_init(void)
{
neigh_table_init(NEIGH_DN_TABLE, &dn_neigh_table);
proc_create("decnet_neigh", S_IRUGO, init_net.proc_net,
proc_create("decnet_neigh", 0444, init_net.proc_net,
&dn_neigh_seq_fops);
}

Expand Down
Loading

0 comments on commit d644406

Please sign in to comment.