mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-05-16 04:56:41 +08:00
IFCONFIG(8): Add const qualifier
This commit is contained in:
parent
c14bb23117
commit
13b50b37cc
@ -71,7 +71,7 @@ static const char rcsid[] =
|
|||||||
eaddr[5] = pv >> 0; \
|
eaddr[5] = pv >> 0; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
static const char *stpstates[] = {
|
static const char *const stpstates[] = {
|
||||||
"disabled",
|
"disabled",
|
||||||
"listening",
|
"listening",
|
||||||
"learning",
|
"learning",
|
||||||
@ -79,12 +79,12 @@ static const char *stpstates[] = {
|
|||||||
"blocking",
|
"blocking",
|
||||||
"discarding"
|
"discarding"
|
||||||
};
|
};
|
||||||
static const char *stpproto[] = {
|
static const char *const stpproto[] = {
|
||||||
"stp",
|
"stp",
|
||||||
"-",
|
"-",
|
||||||
"rstp"
|
"rstp"
|
||||||
};
|
};
|
||||||
static const char *stproles[] = {
|
static const char *const stproles[] = {
|
||||||
"disabled",
|
"disabled",
|
||||||
"root",
|
"root",
|
||||||
"designated",
|
"designated",
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
|
|
||||||
#include "ifconfig.h"
|
#include "ifconfig.h"
|
||||||
|
|
||||||
static const char *carp_states[] = { CARP_STATES };
|
static const char *const carp_states[] = { CARP_STATES };
|
||||||
|
|
||||||
void carp_status(int s);
|
void carp_status(int s);
|
||||||
void setcarp_advbase(const char *,int, int, const struct afswtch *rafp);
|
void setcarp_advbase(const char *,int, int, const struct afswtch *rafp);
|
||||||
|
@ -53,7 +53,7 @@ static const char rcsid[] =
|
|||||||
|
|
||||||
static void gif_status(int);
|
static void gif_status(int);
|
||||||
|
|
||||||
static struct {
|
static const struct {
|
||||||
const char *label;
|
const char *label;
|
||||||
u_int mask;
|
u_int mask;
|
||||||
} gif_opts[] = {
|
} gif_opts[] = {
|
||||||
|
@ -2475,7 +2475,7 @@ static void
|
|||||||
printwmeparam(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
|
printwmeparam(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
|
||||||
{
|
{
|
||||||
#define MS(_v, _f) (((_v) & _f) >> _f##_S)
|
#define MS(_v, _f) (((_v) & _f) >> _f##_S)
|
||||||
static const char *acnames[] = { "BE", "BK", "VO", "VI" };
|
static const char *const acnames[] = { "BE", "BK", "VO", "VI" };
|
||||||
const struct ieee80211_wme_param *wme =
|
const struct ieee80211_wme_param *wme =
|
||||||
(const struct ieee80211_wme_param *) ie;
|
(const struct ieee80211_wme_param *) ie;
|
||||||
int i;
|
int i;
|
||||||
@ -2844,7 +2844,7 @@ printwpsie(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
|
|||||||
|
|
||||||
printf("%s", tag);
|
printf("%s", tag);
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
static const char *dev_pass_id[] = {
|
static const char *const dev_pass_id[] = {
|
||||||
"D", /* Default (PIN) */
|
"D", /* Default (PIN) */
|
||||||
"U", /* User-specified */
|
"U", /* User-specified */
|
||||||
"M", /* Machine-specified */
|
"M", /* Machine-specified */
|
||||||
@ -3397,7 +3397,7 @@ static const char *
|
|||||||
mesh_linkstate_string(uint8_t state)
|
mesh_linkstate_string(uint8_t state)
|
||||||
{
|
{
|
||||||
#define N(a) (sizeof(a) / sizeof(a[0]))
|
#define N(a) (sizeof(a) / sizeof(a[0]))
|
||||||
static const char *state_names[] = {
|
static const char *const state_names[] = {
|
||||||
[0] = "IDLE",
|
[0] = "IDLE",
|
||||||
[1] = "OPEN-TX",
|
[1] = "OPEN-TX",
|
||||||
[2] = "OPEN-RX",
|
[2] = "OPEN-RX",
|
||||||
@ -3726,7 +3726,7 @@ list_wme_aci(int s, const char *tag, int ac)
|
|||||||
static void
|
static void
|
||||||
list_wme(int s)
|
list_wme(int s)
|
||||||
{
|
{
|
||||||
static const char *acnames[] = { "AC_BE", "AC_BK", "AC_VI", "AC_VO" };
|
static const char *const acnames[] = { "AC_BE", "AC_BK", "AC_VI", "AC_VO" };
|
||||||
int ac;
|
int ac;
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
|
@ -93,14 +93,14 @@ static void domediaopt(const char *, int, int);
|
|||||||
static int get_media_subtype(int, const char *);
|
static int get_media_subtype(int, const char *);
|
||||||
static int get_media_mode(int, const char *);
|
static int get_media_mode(int, const char *);
|
||||||
static int get_media_options(int, const char *);
|
static int get_media_options(int, const char *);
|
||||||
static int lookup_media_word(struct ifmedia_description *, const char *);
|
static int lookup_media_word(const struct ifmedia_description *, const char *);
|
||||||
static void print_media_word(int, int);
|
static void print_media_word(int, int);
|
||||||
static void print_media_word_ifconfig(int);
|
static void print_media_word_ifconfig(int);
|
||||||
|
|
||||||
static struct ifmedia_description *get_toptype_desc(int);
|
static const struct ifmedia_description *get_toptype_desc(int);
|
||||||
static struct ifmedia_type_to_subtype *get_toptype_ttos(int);
|
static const struct ifmedia_type_to_subtype *get_toptype_ttos(int);
|
||||||
static struct ifmedia_description *get_subtype_desc(int,
|
static const struct ifmedia_description *get_subtype_desc(int,
|
||||||
struct ifmedia_type_to_subtype *ttos);
|
const struct ifmedia_type_to_subtype *ttos);
|
||||||
|
|
||||||
#define IFM_OPMODE(x) \
|
#define IFM_OPMODE(x) \
|
||||||
((x) & (IFM_IEEE80211_ADHOC | IFM_IEEE80211_HOSTAP | \
|
((x) & (IFM_IEEE80211_ADHOC | IFM_IEEE80211_HOSTAP | \
|
||||||
@ -362,86 +362,86 @@ setmediamode(const char *val, int d, int s, const struct afswtch *afp)
|
|||||||
* A good chunk of this is duplicated from sys/net/ifmedia.c
|
* A good chunk of this is duplicated from sys/net/ifmedia.c
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
|
|
||||||
static struct ifmedia_description ifm_type_descriptions[] =
|
static const struct ifmedia_description ifm_type_descriptions[] =
|
||||||
IFM_TYPE_DESCRIPTIONS;
|
IFM_TYPE_DESCRIPTIONS;
|
||||||
|
|
||||||
static struct ifmedia_description ifm_subtype_ethernet_descriptions[] =
|
static const struct ifmedia_description ifm_subtype_ethernet_descriptions[] =
|
||||||
IFM_SUBTYPE_ETHERNET_DESCRIPTIONS;
|
IFM_SUBTYPE_ETHERNET_DESCRIPTIONS;
|
||||||
|
|
||||||
static struct ifmedia_description ifm_subtype_ethernet_aliases[] =
|
static const struct ifmedia_description ifm_subtype_ethernet_aliases[] =
|
||||||
IFM_SUBTYPE_ETHERNET_ALIASES;
|
IFM_SUBTYPE_ETHERNET_ALIASES;
|
||||||
|
|
||||||
static struct ifmedia_description ifm_subtype_ethernet_option_descriptions[] =
|
static const struct ifmedia_description ifm_subtype_ethernet_option_descriptions[] =
|
||||||
IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS;
|
IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS;
|
||||||
|
|
||||||
static struct ifmedia_description ifm_subtype_tokenring_descriptions[] =
|
static const struct ifmedia_description ifm_subtype_tokenring_descriptions[] =
|
||||||
IFM_SUBTYPE_TOKENRING_DESCRIPTIONS;
|
IFM_SUBTYPE_TOKENRING_DESCRIPTIONS;
|
||||||
|
|
||||||
static struct ifmedia_description ifm_subtype_tokenring_aliases[] =
|
static const struct ifmedia_description ifm_subtype_tokenring_aliases[] =
|
||||||
IFM_SUBTYPE_TOKENRING_ALIASES;
|
IFM_SUBTYPE_TOKENRING_ALIASES;
|
||||||
|
|
||||||
static struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] =
|
static const struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] =
|
||||||
IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS;
|
IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS;
|
||||||
|
|
||||||
static struct ifmedia_description ifm_subtype_fddi_descriptions[] =
|
static const struct ifmedia_description ifm_subtype_fddi_descriptions[] =
|
||||||
IFM_SUBTYPE_FDDI_DESCRIPTIONS;
|
IFM_SUBTYPE_FDDI_DESCRIPTIONS;
|
||||||
|
|
||||||
static struct ifmedia_description ifm_subtype_fddi_aliases[] =
|
static const struct ifmedia_description ifm_subtype_fddi_aliases[] =
|
||||||
IFM_SUBTYPE_FDDI_ALIASES;
|
IFM_SUBTYPE_FDDI_ALIASES;
|
||||||
|
|
||||||
static struct ifmedia_description ifm_subtype_fddi_option_descriptions[] =
|
static const struct ifmedia_description ifm_subtype_fddi_option_descriptions[] =
|
||||||
IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS;
|
IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS;
|
||||||
|
|
||||||
static struct ifmedia_description ifm_subtype_ieee80211_descriptions[] =
|
static const struct ifmedia_description ifm_subtype_ieee80211_descriptions[] =
|
||||||
IFM_SUBTYPE_IEEE80211_DESCRIPTIONS;
|
IFM_SUBTYPE_IEEE80211_DESCRIPTIONS;
|
||||||
|
|
||||||
static struct ifmedia_description ifm_subtype_ieee80211_aliases[] =
|
static const struct ifmedia_description ifm_subtype_ieee80211_aliases[] =
|
||||||
IFM_SUBTYPE_IEEE80211_ALIASES;
|
IFM_SUBTYPE_IEEE80211_ALIASES;
|
||||||
|
|
||||||
static struct ifmedia_description ifm_subtype_ieee80211_option_descriptions[] =
|
static const struct ifmedia_description ifm_subtype_ieee80211_option_descriptions[] =
|
||||||
IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS;
|
IFM_SUBTYPE_IEEE80211_OPTION_DESCRIPTIONS;
|
||||||
|
|
||||||
struct ifmedia_description ifm_subtype_ieee80211_mode_descriptions[] =
|
static const struct ifmedia_description ifm_subtype_ieee80211_mode_descriptions[] =
|
||||||
IFM_SUBTYPE_IEEE80211_MODE_DESCRIPTIONS;
|
IFM_SUBTYPE_IEEE80211_MODE_DESCRIPTIONS;
|
||||||
|
|
||||||
struct ifmedia_description ifm_subtype_ieee80211_mode_aliases[] =
|
static const struct ifmedia_description ifm_subtype_ieee80211_mode_aliases[] =
|
||||||
IFM_SUBTYPE_IEEE80211_MODE_ALIASES;
|
IFM_SUBTYPE_IEEE80211_MODE_ALIASES;
|
||||||
|
|
||||||
static struct ifmedia_description ifm_subtype_atm_descriptions[] =
|
static const struct ifmedia_description ifm_subtype_atm_descriptions[] =
|
||||||
IFM_SUBTYPE_ATM_DESCRIPTIONS;
|
IFM_SUBTYPE_ATM_DESCRIPTIONS;
|
||||||
|
|
||||||
static struct ifmedia_description ifm_subtype_atm_aliases[] =
|
static const struct ifmedia_description ifm_subtype_atm_aliases[] =
|
||||||
IFM_SUBTYPE_ATM_ALIASES;
|
IFM_SUBTYPE_ATM_ALIASES;
|
||||||
|
|
||||||
static struct ifmedia_description ifm_subtype_atm_option_descriptions[] =
|
static const struct ifmedia_description ifm_subtype_atm_option_descriptions[] =
|
||||||
IFM_SUBTYPE_ATM_OPTION_DESCRIPTIONS;
|
IFM_SUBTYPE_ATM_OPTION_DESCRIPTIONS;
|
||||||
|
|
||||||
static struct ifmedia_description ifm_subtype_shared_descriptions[] =
|
static const struct ifmedia_description ifm_subtype_shared_descriptions[] =
|
||||||
IFM_SUBTYPE_SHARED_DESCRIPTIONS;
|
IFM_SUBTYPE_SHARED_DESCRIPTIONS;
|
||||||
|
|
||||||
static struct ifmedia_description ifm_subtype_shared_aliases[] =
|
static const struct ifmedia_description ifm_subtype_shared_aliases[] =
|
||||||
IFM_SUBTYPE_SHARED_ALIASES;
|
IFM_SUBTYPE_SHARED_ALIASES;
|
||||||
|
|
||||||
static struct ifmedia_description ifm_shared_option_descriptions[] =
|
static const struct ifmedia_description ifm_shared_option_descriptions[] =
|
||||||
IFM_SHARED_OPTION_DESCRIPTIONS;
|
IFM_SHARED_OPTION_DESCRIPTIONS;
|
||||||
|
|
||||||
struct ifmedia_type_to_subtype {
|
struct ifmedia_type_to_subtype {
|
||||||
struct {
|
struct {
|
||||||
struct ifmedia_description *desc;
|
const struct ifmedia_description *desc;
|
||||||
int alias;
|
int alias;
|
||||||
} subtypes[5];
|
} subtypes[5];
|
||||||
struct {
|
struct {
|
||||||
struct ifmedia_description *desc;
|
const struct ifmedia_description *desc;
|
||||||
int alias;
|
int alias;
|
||||||
} options[3];
|
} options[3];
|
||||||
struct {
|
struct {
|
||||||
struct ifmedia_description *desc;
|
const struct ifmedia_description *desc;
|
||||||
int alias;
|
int alias;
|
||||||
} modes[3];
|
} modes[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* must be in the same order as IFM_TYPE_DESCRIPTIONS */
|
/* must be in the same order as IFM_TYPE_DESCRIPTIONS */
|
||||||
static struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = {
|
static const struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = {
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
{ &ifm_subtype_shared_descriptions[0], 0 },
|
{ &ifm_subtype_shared_descriptions[0], 0 },
|
||||||
@ -534,8 +534,8 @@ static struct ifmedia_type_to_subtype ifmedia_types_to_subtypes[] = {
|
|||||||
static int
|
static int
|
||||||
get_media_subtype(int type, const char *val)
|
get_media_subtype(int type, const char *val)
|
||||||
{
|
{
|
||||||
struct ifmedia_description *desc;
|
const struct ifmedia_description *desc;
|
||||||
struct ifmedia_type_to_subtype *ttos;
|
const struct ifmedia_type_to_subtype *ttos;
|
||||||
int rval, i;
|
int rval, i;
|
||||||
|
|
||||||
/* Find the top-level interface type. */
|
/* Find the top-level interface type. */
|
||||||
@ -558,8 +558,8 @@ get_media_subtype(int type, const char *val)
|
|||||||
static int
|
static int
|
||||||
get_media_mode(int type, const char *val)
|
get_media_mode(int type, const char *val)
|
||||||
{
|
{
|
||||||
struct ifmedia_description *desc;
|
const struct ifmedia_description *desc;
|
||||||
struct ifmedia_type_to_subtype *ttos;
|
const struct ifmedia_type_to_subtype *ttos;
|
||||||
int rval, i;
|
int rval, i;
|
||||||
|
|
||||||
/* Find the top-level interface type. */
|
/* Find the top-level interface type. */
|
||||||
@ -581,8 +581,8 @@ get_media_mode(int type, const char *val)
|
|||||||
static int
|
static int
|
||||||
get_media_options(int type, const char *val)
|
get_media_options(int type, const char *val)
|
||||||
{
|
{
|
||||||
struct ifmedia_description *desc;
|
const struct ifmedia_description *desc;
|
||||||
struct ifmedia_type_to_subtype *ttos;
|
const struct ifmedia_type_to_subtype *ttos;
|
||||||
char *optlist, *optptr;
|
char *optlist, *optptr;
|
||||||
int option = 0, i, rval = 0;
|
int option = 0, i, rval = 0;
|
||||||
|
|
||||||
@ -620,7 +620,7 @@ get_media_options(int type, const char *val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
lookup_media_word(struct ifmedia_description *desc, const char *val)
|
lookup_media_word(const struct ifmedia_description *desc, const char *val)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (; desc->ifmt_string != NULL; desc++)
|
for (; desc->ifmt_string != NULL; desc++)
|
||||||
@ -630,9 +630,9 @@ lookup_media_word(struct ifmedia_description *desc, const char *val)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ifmedia_description *get_toptype_desc(int ifmw)
|
static const struct ifmedia_description *get_toptype_desc(int ifmw)
|
||||||
{
|
{
|
||||||
struct ifmedia_description *desc;
|
const struct ifmedia_description *desc;
|
||||||
|
|
||||||
for (desc = ifm_type_descriptions; desc->ifmt_string != NULL; desc++)
|
for (desc = ifm_type_descriptions; desc->ifmt_string != NULL; desc++)
|
||||||
if (IFM_TYPE(ifmw) == desc->ifmt_word)
|
if (IFM_TYPE(ifmw) == desc->ifmt_word)
|
||||||
@ -641,10 +641,10 @@ static struct ifmedia_description *get_toptype_desc(int ifmw)
|
|||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ifmedia_type_to_subtype *get_toptype_ttos(int ifmw)
|
static const struct ifmedia_type_to_subtype *get_toptype_ttos(int ifmw)
|
||||||
{
|
{
|
||||||
struct ifmedia_description *desc;
|
const struct ifmedia_description *desc;
|
||||||
struct ifmedia_type_to_subtype *ttos;
|
const struct ifmedia_type_to_subtype *ttos;
|
||||||
|
|
||||||
for (desc = ifm_type_descriptions, ttos = ifmedia_types_to_subtypes;
|
for (desc = ifm_type_descriptions, ttos = ifmedia_types_to_subtypes;
|
||||||
desc->ifmt_string != NULL; desc++, ttos++)
|
desc->ifmt_string != NULL; desc++, ttos++)
|
||||||
@ -654,11 +654,11 @@ static struct ifmedia_type_to_subtype *get_toptype_ttos(int ifmw)
|
|||||||
return ttos;
|
return ttos;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ifmedia_description *get_subtype_desc(int ifmw,
|
static const struct ifmedia_description *get_subtype_desc(int ifmw,
|
||||||
struct ifmedia_type_to_subtype *ttos)
|
const struct ifmedia_type_to_subtype *ttos)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct ifmedia_description *desc;
|
const struct ifmedia_description *desc;
|
||||||
|
|
||||||
for (i = 0; ttos->subtypes[i].desc != NULL; i++) {
|
for (i = 0; ttos->subtypes[i].desc != NULL; i++) {
|
||||||
if (ttos->subtypes[i].alias)
|
if (ttos->subtypes[i].alias)
|
||||||
@ -673,11 +673,11 @@ static struct ifmedia_description *get_subtype_desc(int ifmw,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ifmedia_description *get_mode_desc(int ifmw,
|
static const struct ifmedia_description *get_mode_desc(int ifmw,
|
||||||
struct ifmedia_type_to_subtype *ttos)
|
const struct ifmedia_type_to_subtype *ttos)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct ifmedia_description *desc;
|
const struct ifmedia_description *desc;
|
||||||
|
|
||||||
for (i = 0; ttos->modes[i].desc != NULL; i++) {
|
for (i = 0; ttos->modes[i].desc != NULL; i++) {
|
||||||
if (ttos->modes[i].alias)
|
if (ttos->modes[i].alias)
|
||||||
@ -695,8 +695,8 @@ static struct ifmedia_description *get_mode_desc(int ifmw,
|
|||||||
static void
|
static void
|
||||||
print_media_word(int ifmw, int print_toptype)
|
print_media_word(int ifmw, int print_toptype)
|
||||||
{
|
{
|
||||||
struct ifmedia_description *desc;
|
const struct ifmedia_description *desc;
|
||||||
struct ifmedia_type_to_subtype *ttos;
|
const struct ifmedia_type_to_subtype *ttos;
|
||||||
int seen_option = 0, i;
|
int seen_option = 0, i;
|
||||||
|
|
||||||
/* Find the top-level interface type. */
|
/* Find the top-level interface type. */
|
||||||
@ -755,8 +755,8 @@ print_media_word(int ifmw, int print_toptype)
|
|||||||
static void
|
static void
|
||||||
print_media_word_ifconfig(int ifmw)
|
print_media_word_ifconfig(int ifmw)
|
||||||
{
|
{
|
||||||
struct ifmedia_description *desc;
|
const struct ifmedia_description *desc;
|
||||||
struct ifmedia_type_to_subtype *ttos;
|
const struct ifmedia_type_to_subtype *ttos;
|
||||||
int seen_option = 0, i;
|
int seen_option = 0, i;
|
||||||
|
|
||||||
/* Find the top-level interface type. */
|
/* Find the top-level interface type. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user