Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
net-tools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
net-tools
Commits
742e6280
Commit
742e6280
authored
Aug 25, 2015
by
Mike Frysinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib: hw: constify hwtype
Most callers never modify this structure, so constify it everywhere.
parent
a6118deb
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
19 additions
and
19 deletions
+19
-19
arp.c
arp.c
+5
-5
ifconfig.c
ifconfig.c
+1
-1
lib/activate.c
lib/activate.c
+1
-1
lib/hw.c
lib/hw.c
+7
-7
lib/interface.c
lib/interface.c
+1
-1
lib/net-support.h
lib/net-support.h
+3
-3
rarp.c
rarp.c
+1
-1
No files found.
arp.c
View file @
742e6280
...
@@ -89,7 +89,7 @@ int opt_D = 0; /* HW-address is devicename */
...
@@ -89,7 +89,7 @@ int opt_D = 0; /* HW-address is devicename */
int
opt_e
=
0
;
/* 0=BSD output, 1=new linux */
int
opt_e
=
0
;
/* 0=BSD output, 1=new linux */
int
opt_a
=
0
;
/* all entries, substring match */
int
opt_a
=
0
;
/* all entries, substring match */
const
struct
aftype
*
ap
;
/* current address family */
const
struct
aftype
*
ap
;
/* current address family */
struct
hwtype
*
hw
;
/* current hardware type */
const
struct
hwtype
*
hw
;
/* current hardware type */
int
sockfd
=
0
;
/* active socket descriptor */
int
sockfd
=
0
;
/* active socket descriptor */
int
hw_set
=
0
;
/* flag if hw-type was set (-H) */
int
hw_set
=
0
;
/* flag if hw-type was set (-H) */
char
device
[
16
]
=
""
;
/* current device */
char
device
[
16
]
=
""
;
/* current device */
...
@@ -238,10 +238,10 @@ static int arp_del(char **args)
...
@@ -238,10 +238,10 @@ static int arp_del(char **args)
}
}
/* Get the hardware address to a specified interface name */
/* Get the hardware address to a specified interface name */
static
int
arp_getdevhw
(
char
*
ifname
,
struct
sockaddr
*
sa
,
struct
hwtype
*
hw
)
static
int
arp_getdevhw
(
char
*
ifname
,
struct
sockaddr
*
sa
,
const
struct
hwtype
*
hw
)
{
{
struct
ifreq
ifr
;
struct
ifreq
ifr
;
struct
hwtype
*
xhw
;
const
struct
hwtype
*
xhw
;
safe_strncpy
(
ifr
.
ifr_name
,
ifname
,
IFNAMSIZ
);
safe_strncpy
(
ifr
.
ifr_name
,
ifname
,
IFNAMSIZ
);
if
(
ioctl
(
sockfd
,
SIOCGIFHWADDR
,
&
ifr
)
<
0
)
{
if
(
ioctl
(
sockfd
,
SIOCGIFHWADDR
,
&
ifr
)
<
0
)
{
...
@@ -437,7 +437,7 @@ static int arp_file(char *name)
...
@@ -437,7 +437,7 @@ static int arp_file(char *name)
static
void
arp_disp_2
(
const
char
*
name
,
int
type
,
int
arp_flags
,
const
char
*
hwa
,
const
char
*
mask
,
const
char
*
dev
)
static
void
arp_disp_2
(
const
char
*
name
,
int
type
,
int
arp_flags
,
const
char
*
hwa
,
const
char
*
mask
,
const
char
*
dev
)
{
{
static
int
title
=
0
;
static
int
title
=
0
;
struct
hwtype
*
xhw
;
const
struct
hwtype
*
xhw
;
char
flags
[
10
];
char
flags
[
10
];
xhw
=
get_hwntype
(
type
);
xhw
=
get_hwntype
(
type
);
...
@@ -486,7 +486,7 @@ static void arp_disp_2(const char *name, int type, int arp_flags, const char *hw
...
@@ -486,7 +486,7 @@ static void arp_disp_2(const char *name, int type, int arp_flags, const char *hw
/* Print the contents of an ARP request block. */
/* Print the contents of an ARP request block. */
static
void
arp_disp
(
const
char
*
name
,
const
char
*
ip
,
int
type
,
int
arp_flags
,
const
char
*
hwa
,
const
char
*
mask
,
const
char
*
dev
)
static
void
arp_disp
(
const
char
*
name
,
const
char
*
ip
,
int
type
,
int
arp_flags
,
const
char
*
hwa
,
const
char
*
mask
,
const
char
*
dev
)
{
{
struct
hwtype
*
xhw
;
const
struct
hwtype
*
xhw
;
xhw
=
get_hwntype
(
type
);
xhw
=
get_hwntype
(
type
);
if
(
xhw
==
NULL
)
if
(
xhw
==
NULL
)
...
...
ifconfig.c
View file @
742e6280
...
@@ -258,7 +258,7 @@ int main(int argc, char **argv)
...
@@ -258,7 +258,7 @@ int main(int argc, char **argv)
struct
sockaddr_in
*
sin
=
(
struct
sockaddr_in
*
)
sa
;
struct
sockaddr_in
*
sin
=
(
struct
sockaddr_in
*
)
sa
;
char
host
[
128
];
char
host
[
128
];
const
struct
aftype
*
ap
;
const
struct
aftype
*
ap
;
struct
hwtype
*
hw
;
const
struct
hwtype
*
hw
;
struct
ifreq
ifr
;
struct
ifreq
ifr
;
int
goterr
=
0
,
didnetmask
=
0
,
neednetmask
=
0
;
int
goterr
=
0
,
didnetmask
=
0
,
neednetmask
=
0
;
char
**
spp
;
char
**
spp
;
...
...
lib/activate.c
View file @
742e6280
...
@@ -61,7 +61,7 @@ void activate_init(void)
...
@@ -61,7 +61,7 @@ void activate_init(void)
int
activate_ld
(
const
char
*
hwname
,
int
fd
)
int
activate_ld
(
const
char
*
hwname
,
int
fd
)
{
{
struct
hwtype
*
hw
;
const
struct
hwtype
*
hw
;
hw
=
get_hwtype
(
hwname
);
hw
=
get_hwtype
(
hwname
);
...
...
lib/hw.c
View file @
742e6280
...
@@ -77,7 +77,7 @@ extern struct hwtype ib_hwtype;
...
@@ -77,7 +77,7 @@ extern struct hwtype ib_hwtype;
extern
struct
hwtype
eui64_hwtype
;
extern
struct
hwtype
eui64_hwtype
;
static
struct
hwtype
*
hwtypes
[]
=
static
const
struct
hwtype
*
const
hwtypes
[]
=
{
{
&
loop_hwtype
,
&
loop_hwtype
,
...
@@ -237,9 +237,9 @@ static void hwinit(void)
...
@@ -237,9 +237,9 @@ static void hwinit(void)
}
}
/* Check our hardware type table for this type. */
/* Check our hardware type table for this type. */
struct
hwtype
*
get_hwtype
(
const
char
*
name
)
const
struct
hwtype
*
get_hwtype
(
const
char
*
name
)
{
{
struct
hwtype
*
*
hwp
;
const
struct
hwtype
*
const
*
hwp
;
if
(
!
sVhwinit
)
if
(
!
sVhwinit
)
hwinit
();
hwinit
();
...
@@ -255,9 +255,9 @@ struct hwtype *get_hwtype(const char *name)
...
@@ -255,9 +255,9 @@ struct hwtype *get_hwtype(const char *name)
/* Check our hardware type table for this type. */
/* Check our hardware type table for this type. */
struct
hwtype
*
get_hwntype
(
int
type
)
const
struct
hwtype
*
get_hwntype
(
int
type
)
{
{
struct
hwtype
*
*
hwp
;
const
struct
hwtype
*
const
*
hwp
;
if
(
!
sVhwinit
)
if
(
!
sVhwinit
)
hwinit
();
hwinit
();
...
@@ -275,7 +275,7 @@ struct hwtype *get_hwntype(int type)
...
@@ -275,7 +275,7 @@ struct hwtype *get_hwntype(int type)
void
print_hwlist
(
int
type
)
{
void
print_hwlist
(
int
type
)
{
int
count
=
0
;
int
count
=
0
;
const
char
*
txt
;
const
char
*
txt
;
struct
hwtype
*
*
hwp
;
const
struct
hwtype
*
const
*
hwp
;
if
(
!
sVhwinit
)
if
(
!
sVhwinit
)
hwinit
();
hwinit
();
...
@@ -295,7 +295,7 @@ void print_hwlist(int type) {
...
@@ -295,7 +295,7 @@ void print_hwlist(int type) {
}
}
/* return 1 if address is all zeros */
/* return 1 if address is all zeros */
int
hw_null_address
(
struct
hwtype
*
hw
,
void
*
ap
)
int
hw_null_address
(
const
struct
hwtype
*
hw
,
void
*
ap
)
{
{
unsigned
int
i
;
unsigned
int
i
;
unsigned
char
*
address
=
(
unsigned
char
*
)
ap
;
unsigned
char
*
address
=
(
unsigned
char
*
)
ap
;
...
...
lib/interface.c
View file @
742e6280
...
@@ -647,7 +647,7 @@ void ife_print_short(struct interface *ptr)
...
@@ -647,7 +647,7 @@ void ife_print_short(struct interface *ptr)
void
ife_print_long
(
struct
interface
*
ptr
)
void
ife_print_long
(
struct
interface
*
ptr
)
{
{
const
struct
aftype
*
ap
;
const
struct
aftype
*
ap
;
struct
hwtype
*
hw
;
const
struct
hwtype
*
hw
;
int
hf
;
int
hf
;
int
can_compress
=
0
;
int
can_compress
=
0
;
unsigned
long
long
rx
,
tx
,
short_rx
,
short_tx
;
unsigned
long
long
rx
,
tx
,
short_rx
,
short_tx
;
...
...
lib/net-support.h
View file @
742e6280
...
@@ -67,13 +67,13 @@ struct hwtype {
...
@@ -67,13 +67,13 @@ struct hwtype {
};
};
extern
struct
hwtype
*
get_hwtype
(
const
char
*
name
);
extern
const
struct
hwtype
*
get_hwtype
(
const
char
*
name
);
extern
struct
hwtype
*
get_hwntype
(
int
type
);
extern
const
struct
hwtype
*
get_hwntype
(
int
type
);
extern
void
print_hwlist
(
int
type
);
extern
void
print_hwlist
(
int
type
);
extern
const
struct
aftype
*
get_aftype
(
const
char
*
name
);
extern
const
struct
aftype
*
get_aftype
(
const
char
*
name
);
extern
const
struct
aftype
*
get_afntype
(
int
type
);
extern
const
struct
aftype
*
get_afntype
(
int
type
);
extern
void
print_aflist
(
int
type
);
extern
void
print_aflist
(
int
type
);
extern
int
hw_null_address
(
struct
hwtype
*
hw
,
void
*
addr
);
extern
int
hw_null_address
(
const
struct
hwtype
*
hw
,
void
*
addr
);
extern
int
getargs
(
char
*
string
,
char
*
arguments
[]);
extern
int
getargs
(
char
*
string
,
char
*
arguments
[]);
...
...
rarp.c
View file @
742e6280
...
@@ -46,7 +46,7 @@ static char no_rarp_message[] = N_("This kernel does not support RARP.\n");
...
@@ -46,7 +46,7 @@ static char no_rarp_message[] = N_("This kernel does not support RARP.\n");
static
char
*
Release
=
RELEASE
;
static
char
*
Release
=
RELEASE
;
static
struct
hwtype
*
hardware
=
NULL
;
static
const
struct
hwtype
*
hardware
=
NULL
;
/* Delete an entry from the RARP cache. */
/* Delete an entry from the RARP cache. */
static
int
rarp_delete
(
int
fd
,
struct
hostent
*
hp
)
static
int
rarp_delete
(
int
fd
,
struct
hostent
*
hp
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment