Use const and static as needed, disable unused code

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3452 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
blueswir1 2007-10-26 19:01:16 +00:00
parent 31a60e2275
commit 9634d9031c
28 changed files with 163 additions and 221 deletions

View file

@ -51,14 +51,17 @@ struct udpstat udpstat;
struct socket udb;
static u_int8_t udp_tos(struct socket *so);
static void udp_emu(struct socket *so, struct mbuf *m);
/*
* UDP protocol implementation.
* Per RFC 768, August, 1980.
*/
#ifndef COMPAT_42
int udpcksum = 1;
#define UDPCKSUM 1
#else
int udpcksum = 0; /* XXX */
#define UDPCKSUM 0 /* XXX */
#endif
struct socket *udp_last_so = &udb;
@ -132,7 +135,7 @@ udp_input(m, iphlen)
/*
* Checksum extended UDP header and data.
*/
if (udpcksum && uh->uh_sum) {
if (UDPCKSUM && uh->uh_sum) {
((struct ipovly *)ip)->ih_next = 0;
((struct ipovly *)ip)->ih_prev = 0;
((struct ipovly *)ip)->ih_x1 = 0;
@ -292,13 +295,13 @@ int udp_output2(struct socket *so, struct mbuf *m,
* Stuff checksum and output datagram.
*/
ui->ui_sum = 0;
if (udpcksum) {
if (UDPCKSUM) {
if ((ui->ui_sum = cksum(m, /* sizeof (struct udpiphdr) + */ m->m_len)) == 0)
ui->ui_sum = 0xffff;
}
((struct ip *)ui)->ip_len = m->m_len;
((struct ip *)ui)->ip_ttl = ip_defttl;
((struct ip *)ui)->ip_ttl = IPDEFTTL;
((struct ip *)ui)->ip_tos = iptos;
STAT(udpstat.udps_opackets++);
@ -369,7 +372,7 @@ udp_detach(so)
sofree(so);
}
struct tos_t udptos[] = {
static const struct tos_t udptos[] = {
{0, 53, IPTOS_LOWDELAY, 0}, /* DNS */
{517, 517, IPTOS_LOWDELAY, EMU_TALK}, /* talk */
{518, 518, IPTOS_LOWDELAY, EMU_NTALK}, /* ntalk */
@ -377,9 +380,8 @@ struct tos_t udptos[] = {
{0, 0, 0, 0}
};
u_int8_t
udp_tos(so)
struct socket *so;
static u_int8_t
udp_tos(struct socket *so)
{
int i = 0;
@ -402,10 +404,8 @@ udp_tos(so)
/*
* Here, talk/ytalk/ntalk requests must be emulated
*/
void
udp_emu(so, m)
struct socket *so;
struct mbuf *m;
static void
udp_emu(struct socket *so, struct mbuf *m)
{
struct sockaddr_in addr;
int addrlen = sizeof(addr);