rt_names: style cleanup
Cleanup all checkpatch complaints about whitespace in rt_names.
This commit is contained in:
parent
13ada95da4
commit
68ef507249
|
|
@ -167,7 +167,7 @@ const char * rtnl_rtprot_n2a(int id, char *buf, int len)
|
|||
|
||||
int rtnl_rtprot_a2n(__u32 *id, const char *arg)
|
||||
{
|
||||
static char *cache = NULL;
|
||||
static char *cache;
|
||||
static unsigned long res;
|
||||
char *end;
|
||||
int i;
|
||||
|
|
@ -197,8 +197,13 @@ int rtnl_rtprot_a2n(__u32 *id, const char *arg)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static char *rtnl_rtscope_tab[256] = {
|
||||
"global",
|
||||
[RT_SCOPE_UNIVERSE] = "global",
|
||||
[RT_SCOPE_NOWHERE] = "nowhere",
|
||||
[RT_SCOPE_HOST] = "host",
|
||||
[RT_SCOPE_LINK] = "link",
|
||||
[RT_SCOPE_SITE] = "site",
|
||||
};
|
||||
|
||||
static int rtnl_rtscope_init;
|
||||
|
|
@ -206,10 +211,6 @@ static int rtnl_rtscope_init;
|
|||
static void rtnl_rtscope_initialize(void)
|
||||
{
|
||||
rtnl_rtscope_init = 1;
|
||||
rtnl_rtscope_tab[RT_SCOPE_NOWHERE] = "nowhere";
|
||||
rtnl_rtscope_tab[RT_SCOPE_HOST] = "host";
|
||||
rtnl_rtscope_tab[RT_SCOPE_LINK] = "link";
|
||||
rtnl_rtscope_tab[RT_SCOPE_SITE] = "site";
|
||||
rtnl_tab_initialize(CONFDIR "/rt_scopes",
|
||||
rtnl_rtscope_tab, 256);
|
||||
}
|
||||
|
|
@ -220,19 +221,22 @@ const char *rtnl_rtscope_n2a(int id, char *buf, int len)
|
|||
snprintf(buf, len, "%d", id);
|
||||
return buf;
|
||||
}
|
||||
|
||||
if (!rtnl_rtscope_tab[id]) {
|
||||
if (!rtnl_rtscope_init)
|
||||
rtnl_rtscope_initialize();
|
||||
}
|
||||
|
||||
if (rtnl_rtscope_tab[id])
|
||||
return rtnl_rtscope_tab[id];
|
||||
|
||||
snprintf(buf, len, "%d", id);
|
||||
return buf;
|
||||
}
|
||||
|
||||
int rtnl_rtscope_a2n(__u32 *id, const char *arg)
|
||||
{
|
||||
static const char *cache = NULL;
|
||||
static const char *cache;
|
||||
static unsigned long res;
|
||||
char *end;
|
||||
int i;
|
||||
|
|
@ -295,7 +299,7 @@ const char *rtnl_rtrealm_n2a(int id, char *buf, int len)
|
|||
|
||||
int rtnl_rtrealm_a2n(__u32 *id, const char *arg)
|
||||
{
|
||||
static char *cache = NULL;
|
||||
static char *cache;
|
||||
static unsigned long res;
|
||||
char *end;
|
||||
int i;
|
||||
|
|
@ -370,7 +374,8 @@ static void rtnl_rttable_initialize(void)
|
|||
if (strcmp(de->d_name + len - 5, ".conf"))
|
||||
continue;
|
||||
|
||||
snprintf(path, sizeof(path), CONFDIR "/rt_tables.d/%s", de->d_name);
|
||||
snprintf(path, sizeof(path),
|
||||
CONFDIR "/rt_tables.d/%s", de->d_name);
|
||||
rtnl_hash_initialize(path, rtnl_rttable_hash, 256);
|
||||
}
|
||||
closedir(d);
|
||||
|
|
@ -397,7 +402,7 @@ const char * rtnl_rttable_n2a(__u32 id, char *buf, int len)
|
|||
|
||||
int rtnl_rttable_a2n(__u32 *id, const char *arg)
|
||||
{
|
||||
static const char *cache = NULL;
|
||||
static const char *cache;
|
||||
static unsigned long res;
|
||||
struct rtnl_hash_entry *entry;
|
||||
char *end;
|
||||
|
|
@ -463,7 +468,7 @@ const char *rtnl_dsfield_n2a(int id, char *buf, int len)
|
|||
|
||||
int rtnl_dsfield_a2n(__u32 *id, const char *arg)
|
||||
{
|
||||
static char *cache = NULL;
|
||||
static char *cache;
|
||||
static unsigned long res;
|
||||
char *end;
|
||||
int i;
|
||||
|
|
@ -494,7 +499,9 @@ int rtnl_dsfield_a2n(__u32 *id, const char *arg)
|
|||
}
|
||||
|
||||
|
||||
static struct rtnl_hash_entry dflt_group_entry = { .id = 0, .name = "default" };
|
||||
static struct rtnl_hash_entry dflt_group_entry = {
|
||||
.id = 0, .name = "default"
|
||||
};
|
||||
|
||||
static struct rtnl_hash_entry *rtnl_group_hash[256] = {
|
||||
[0] = &dflt_group_entry,
|
||||
|
|
@ -511,7 +518,7 @@ static void rtnl_group_initialize(void)
|
|||
|
||||
int rtnl_group_a2n(int *id, const char *arg)
|
||||
{
|
||||
static const char *cache = NULL;
|
||||
static const char *cache;
|
||||
static unsigned long res;
|
||||
struct rtnl_hash_entry *entry;
|
||||
char *end;
|
||||
|
|
@ -554,10 +561,9 @@ const char *rtnl_group_n2a(int id, char *buf, int len)
|
|||
|
||||
for (i = 0; i < 256; i++) {
|
||||
entry = rtnl_group_hash[i];
|
||||
if (entry && entry->id == id) {
|
||||
if (entry && entry->id == id)
|
||||
return entry->name;
|
||||
}
|
||||
}
|
||||
|
||||
snprintf(buf, len, "%d", id);
|
||||
return buf;
|
||||
|
|
@ -615,7 +621,7 @@ const char *nl_proto_n2a(int id, char *buf, int len)
|
|||
|
||||
int nl_proto_a2n(__u32 *id, const char *arg)
|
||||
{
|
||||
static char *cache = NULL;
|
||||
static char *cache;
|
||||
static unsigned long res;
|
||||
char *end;
|
||||
int i;
|
||||
|
|
|
|||
Loading…
Reference in New Issue