Skip to content

Commit 507b37c

Browse files
ecsvsimonwunderlich
authored andcommitted
batman-adv: Use octal permissions instead of macros
Linus prefers to have octal permission numbers instead of combinations of macro names ("random line noise"). Also old existing "bad symbolic permission bit macro use" should be converted to octal numbers. (http://lkml.kernel.org/r/CA+55aFw5v23T-zvDZp-MmD_EYxF8WbafwwB59934FV7g21uMGQ@mail.gmail.com) Also remove the S_IFREG bit from the octal representation because it is filtered out by debugfs_create. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
1 parent 70ea5ce commit 507b37c

5 files changed

Lines changed: 41 additions & 55 deletions

File tree

‎net/batman-adv/debugfs.c‎

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -186,34 +186,32 @@ struct batadv_debuginfo batadv_debuginfo_##_name = { \
186186
/* the following attributes are general and therefore they will be directly
187187
* placed in the BATADV_DEBUGFS_SUBDIR subdirectory of debugfs
188188
*/
189-
static BATADV_DEBUGINFO(routing_algos, S_IRUGO, batadv_algorithms_open);
189+
static BATADV_DEBUGINFO(routing_algos, 0444, batadv_algorithms_open);
190190

191191
static struct batadv_debuginfo *batadv_general_debuginfos[] = {
192192
&batadv_debuginfo_routing_algos,
193193
NULL,
194194
};
195195

196196
/* The following attributes are per soft interface */
197-
static BATADV_DEBUGINFO(neighbors, S_IRUGO, neighbors_open);
198-
static BATADV_DEBUGINFO(originators, S_IRUGO, batadv_originators_open);
199-
static BATADV_DEBUGINFO(gateways, S_IRUGO, batadv_gateways_open);
200-
static BATADV_DEBUGINFO(transtable_global, S_IRUGO,
201-
batadv_transtable_global_open);
197+
static BATADV_DEBUGINFO(neighbors, 0444, neighbors_open);
198+
static BATADV_DEBUGINFO(originators, 0444, batadv_originators_open);
199+
static BATADV_DEBUGINFO(gateways, 0444, batadv_gateways_open);
200+
static BATADV_DEBUGINFO(transtable_global, 0444, batadv_transtable_global_open);
202201
#ifdef CONFIG_BATMAN_ADV_BLA
203-
static BATADV_DEBUGINFO(bla_claim_table, S_IRUGO, batadv_bla_claim_table_open);
204-
static BATADV_DEBUGINFO(bla_backbone_table, S_IRUGO,
202+
static BATADV_DEBUGINFO(bla_claim_table, 0444, batadv_bla_claim_table_open);
203+
static BATADV_DEBUGINFO(bla_backbone_table, 0444,
205204
batadv_bla_backbone_table_open);
206205
#endif
207206
#ifdef CONFIG_BATMAN_ADV_DAT
208-
static BATADV_DEBUGINFO(dat_cache, S_IRUGO, batadv_dat_cache_open);
207+
static BATADV_DEBUGINFO(dat_cache, 0444, batadv_dat_cache_open);
209208
#endif
210-
static BATADV_DEBUGINFO(transtable_local, S_IRUGO,
211-
batadv_transtable_local_open);
209+
static BATADV_DEBUGINFO(transtable_local, 0444, batadv_transtable_local_open);
212210
#ifdef CONFIG_BATMAN_ADV_NC
213-
static BATADV_DEBUGINFO(nc_nodes, S_IRUGO, batadv_nc_nodes_open);
211+
static BATADV_DEBUGINFO(nc_nodes, 0444, batadv_nc_nodes_open);
214212
#endif
215213
#ifdef CONFIG_BATMAN_ADV_MCAST
216-
static BATADV_DEBUGINFO(mcast_flags, S_IRUGO, batadv_mcast_flags_open);
214+
static BATADV_DEBUGINFO(mcast_flags, 0444, batadv_mcast_flags_open);
217215
#endif
218216

219217
static struct batadv_debuginfo *batadv_mesh_debuginfos[] = {
@@ -253,7 +251,7 @@ struct batadv_debuginfo batadv_hardif_debuginfo_##_name = { \
253251
}, \
254252
}
255253

256-
static BATADV_HARDIF_DEBUGINFO(originators, S_IRUGO,
254+
static BATADV_HARDIF_DEBUGINFO(originators, 0444,
257255
batadv_originators_hardif_open);
258256

259257
static struct batadv_debuginfo *batadv_hardif_debuginfos[] = {

‎net/batman-adv/icmp_socket.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include <linux/skbuff.h>
3939
#include <linux/slab.h>
4040
#include <linux/spinlock.h>
41-
#include <linux/stat.h>
4241
#include <linux/stddef.h>
4342
#include <linux/string.h>
4443
#include <linux/uaccess.h>
@@ -322,8 +321,8 @@ int batadv_socket_setup(struct batadv_priv *bat_priv)
322321
if (!bat_priv->debug_dir)
323322
goto err;
324323

325-
d = debugfs_create_file(BATADV_ICMP_SOCKET, S_IFREG | S_IWUSR | S_IRUSR,
326-
bat_priv->debug_dir, bat_priv, &batadv_fops);
324+
d = debugfs_create_file(BATADV_ICMP_SOCKET, 0600, bat_priv->debug_dir,
325+
bat_priv, &batadv_fops);
327326
if (!d)
328327
goto err;
329328

‎net/batman-adv/log.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include <linux/sched.h> /* for linux/wait.h */
3232
#include <linux/slab.h>
3333
#include <linux/spinlock.h>
34-
#include <linux/stat.h>
3534
#include <linux/stddef.h>
3635
#include <linux/types.h>
3736
#include <linux/uaccess.h>
@@ -212,8 +211,7 @@ int batadv_debug_log_setup(struct batadv_priv *bat_priv)
212211
spin_lock_init(&bat_priv->debug_log->lock);
213212
init_waitqueue_head(&bat_priv->debug_log->queue_wait);
214213

215-
d = debugfs_create_file("log", S_IFREG | S_IRUSR,
216-
bat_priv->debug_dir, bat_priv,
214+
d = debugfs_create_file("log", 0400, bat_priv->debug_dir, bat_priv,
217215
&batadv_log_fops);
218216
if (!d)
219217
goto err;

‎net/batman-adv/network-coding.c‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
#include <linux/skbuff.h>
4545
#include <linux/slab.h>
4646
#include <linux/spinlock.h>
47-
#include <linux/stat.h>
4847
#include <linux/stddef.h>
4948
#include <linux/string.h>
5049
#include <linux/workqueue.h>
@@ -1961,17 +1960,16 @@ int batadv_nc_init_debugfs(struct batadv_priv *bat_priv)
19611960
if (!nc_dir)
19621961
goto out;
19631962

1964-
file = debugfs_create_u8("min_tq", S_IRUGO | S_IWUSR, nc_dir,
1965-
&bat_priv->nc.min_tq);
1963+
file = debugfs_create_u8("min_tq", 0644, nc_dir, &bat_priv->nc.min_tq);
19661964
if (!file)
19671965
goto out;
19681966

1969-
file = debugfs_create_u32("max_fwd_delay", S_IRUGO | S_IWUSR, nc_dir,
1967+
file = debugfs_create_u32("max_fwd_delay", 0644, nc_dir,
19701968
&bat_priv->nc.max_fwd_delay);
19711969
if (!file)
19721970
goto out;
19731971

1974-
file = debugfs_create_u32("max_buffer_time", S_IRUGO | S_IWUSR, nc_dir,
1972+
file = debugfs_create_u32("max_buffer_time", 0644, nc_dir,
19751973
&bat_priv->nc.max_buffer_time);
19761974
if (!file)
19771975
goto out;

‎net/batman-adv/sysfs.c‎

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include <linux/rcupdate.h>
3434
#include <linux/rtnetlink.h>
3535
#include <linux/slab.h>
36-
#include <linux/stat.h>
3736
#include <linux/stddef.h>
3837
#include <linux/string.h>
3938
#include <linux/stringify.h>
@@ -666,41 +665,36 @@ static ssize_t batadv_store_isolation_mark(struct kobject *kobj,
666665
return count;
667666
}
668667

669-
BATADV_ATTR_SIF_BOOL(aggregated_ogms, S_IRUGO | S_IWUSR, NULL);
670-
BATADV_ATTR_SIF_BOOL(bonding, S_IRUGO | S_IWUSR, NULL);
668+
BATADV_ATTR_SIF_BOOL(aggregated_ogms, 0644, NULL);
669+
BATADV_ATTR_SIF_BOOL(bonding, 0644, NULL);
671670
#ifdef CONFIG_BATMAN_ADV_BLA
672-
BATADV_ATTR_SIF_BOOL(bridge_loop_avoidance, S_IRUGO | S_IWUSR,
673-
batadv_bla_status_update);
671+
BATADV_ATTR_SIF_BOOL(bridge_loop_avoidance, 0644, batadv_bla_status_update);
674672
#endif
675673
#ifdef CONFIG_BATMAN_ADV_DAT
676-
BATADV_ATTR_SIF_BOOL(distributed_arp_table, S_IRUGO | S_IWUSR,
677-
batadv_dat_status_update);
674+
BATADV_ATTR_SIF_BOOL(distributed_arp_table, 0644, batadv_dat_status_update);
678675
#endif
679-
BATADV_ATTR_SIF_BOOL(fragmentation, S_IRUGO | S_IWUSR, batadv_update_min_mtu);
680-
static BATADV_ATTR(routing_algo, S_IRUGO, batadv_show_bat_algo, NULL);
681-
static BATADV_ATTR(gw_mode, S_IRUGO | S_IWUSR, batadv_show_gw_mode,
682-
batadv_store_gw_mode);
683-
BATADV_ATTR_SIF_UINT(orig_interval, orig_interval, S_IRUGO | S_IWUSR,
684-
2 * BATADV_JITTER, INT_MAX, NULL);
685-
BATADV_ATTR_SIF_UINT(hop_penalty, hop_penalty, S_IRUGO | S_IWUSR, 0,
686-
BATADV_TQ_MAX_VALUE, NULL);
687-
static BATADV_ATTR(gw_sel_class, S_IRUGO | S_IWUSR, batadv_show_gw_sel_class,
676+
BATADV_ATTR_SIF_BOOL(fragmentation, 0644, batadv_update_min_mtu);
677+
static BATADV_ATTR(routing_algo, 0444, batadv_show_bat_algo, NULL);
678+
static BATADV_ATTR(gw_mode, 0644, batadv_show_gw_mode, batadv_store_gw_mode);
679+
BATADV_ATTR_SIF_UINT(orig_interval, orig_interval, 0644, 2 * BATADV_JITTER,
680+
INT_MAX, NULL);
681+
BATADV_ATTR_SIF_UINT(hop_penalty, hop_penalty, 0644, 0, BATADV_TQ_MAX_VALUE,
682+
NULL);
683+
static BATADV_ATTR(gw_sel_class, 0644, batadv_show_gw_sel_class,
688684
batadv_store_gw_sel_class);
689-
static BATADV_ATTR(gw_bandwidth, S_IRUGO | S_IWUSR, batadv_show_gw_bwidth,
685+
static BATADV_ATTR(gw_bandwidth, 0644, batadv_show_gw_bwidth,
690686
batadv_store_gw_bwidth);
691687
#ifdef CONFIG_BATMAN_ADV_MCAST
692-
BATADV_ATTR_SIF_BOOL(multicast_mode, S_IRUGO | S_IWUSR, NULL);
688+
BATADV_ATTR_SIF_BOOL(multicast_mode, 0644, NULL);
693689
#endif
694690
#ifdef CONFIG_BATMAN_ADV_DEBUG
695-
BATADV_ATTR_SIF_UINT(log_level, log_level, S_IRUGO | S_IWUSR, 0,
696-
BATADV_DBG_ALL, NULL);
691+
BATADV_ATTR_SIF_UINT(log_level, log_level, 0644, 0, BATADV_DBG_ALL, NULL);
697692
#endif
698693
#ifdef CONFIG_BATMAN_ADV_NC
699-
BATADV_ATTR_SIF_BOOL(network_coding, S_IRUGO | S_IWUSR,
700-
batadv_nc_status_update);
694+
BATADV_ATTR_SIF_BOOL(network_coding, 0644, batadv_nc_status_update);
701695
#endif
702-
static BATADV_ATTR(isolation_mark, S_IRUGO | S_IWUSR,
703-
batadv_show_isolation_mark, batadv_store_isolation_mark);
696+
static BATADV_ATTR(isolation_mark, 0644, batadv_show_isolation_mark,
697+
batadv_store_isolation_mark);
704698

705699
static struct batadv_attribute *batadv_mesh_attrs[] = {
706700
&batadv_attr_aggregated_ogms,
@@ -731,7 +725,7 @@ static struct batadv_attribute *batadv_mesh_attrs[] = {
731725
NULL,
732726
};
733727

734-
BATADV_ATTR_VLAN_BOOL(ap_isolation, S_IRUGO | S_IWUSR, NULL);
728+
BATADV_ATTR_VLAN_BOOL(ap_isolation, 0644, NULL);
735729

736730
/* array of vlan specific sysfs attributes */
737731
static struct batadv_attribute *batadv_vlan_attrs[] = {
@@ -1116,14 +1110,13 @@ static ssize_t batadv_show_throughput_override(struct kobject *kobj,
11161110

11171111
#endif
11181112

1119-
static BATADV_ATTR(mesh_iface, S_IRUGO | S_IWUSR, batadv_show_mesh_iface,
1113+
static BATADV_ATTR(mesh_iface, 0644, batadv_show_mesh_iface,
11201114
batadv_store_mesh_iface);
1121-
static BATADV_ATTR(iface_status, S_IRUGO, batadv_show_iface_status, NULL);
1115+
static BATADV_ATTR(iface_status, 0444, batadv_show_iface_status, NULL);
11221116
#ifdef CONFIG_BATMAN_ADV_BATMAN_V
1123-
BATADV_ATTR_HIF_UINT(elp_interval, bat_v.elp_interval, S_IRUGO | S_IWUSR,
1117+
BATADV_ATTR_HIF_UINT(elp_interval, bat_v.elp_interval, 0644,
11241118
2 * BATADV_JITTER, INT_MAX, NULL);
1125-
static BATADV_ATTR(throughput_override, S_IRUGO | S_IWUSR,
1126-
batadv_show_throughput_override,
1119+
static BATADV_ATTR(throughput_override, 0644, batadv_show_throughput_override,
11271120
batadv_store_throughput_override);
11281121
#endif
11291122

0 commit comments

Comments
 (0)