Cosmetic: shorten staircases. Join some lines.
This commit is contained in:
parent
38a2eeb907
commit
8a7761f76c
56
sys/net/if.c
56
sys/net/if.c
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: if.c,v 1.217 2008/02/07 08:48:16 martin Exp $ */
|
/* $NetBSD: if.c,v 1.218 2008/02/29 21:23:55 dyoung Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
|
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.217 2008/02/07 08:48:16 martin Exp $");
|
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.218 2008/02/29 21:23:55 dyoung Exp $");
|
||||||
|
|
||||||
#include "opt_inet.h"
|
#include "opt_inet.h"
|
||||||
|
|
||||||
|
@ -552,8 +552,7 @@ if_deactivate(struct ifnet *ifp)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
if_purgeaddrs(struct ifnet *ifp, int family,
|
if_purgeaddrs(struct ifnet *ifp, int family, void (*purgeaddr)(struct ifaddr *))
|
||||||
void (*purgeaddr)(struct ifaddr *))
|
|
||||||
{
|
{
|
||||||
struct ifaddr *ifa, *nifa;
|
struct ifaddr *ifa, *nifa;
|
||||||
|
|
||||||
|
@ -1716,18 +1715,17 @@ ifconf(u_long cmd, void *data)
|
||||||
if (IFADDR_EMPTY(ifp)) {
|
if (IFADDR_EMPTY(ifp)) {
|
||||||
/* Interface with no addresses - send zero sockaddr. */
|
/* Interface with no addresses - send zero sockaddr. */
|
||||||
memset(&ifr.ifr_addr, 0, sizeof(ifr.ifr_addr));
|
memset(&ifr.ifr_addr, 0, sizeof(ifr.ifr_addr));
|
||||||
if (ifrp != NULL)
|
if (ifrp == NULL) {
|
||||||
{
|
|
||||||
if (space >= sz) {
|
|
||||||
error = copyout(&ifr, ifrp, sz);
|
|
||||||
if (error != 0)
|
|
||||||
return (error);
|
|
||||||
ifrp++; space -= sz;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
space += sz;
|
space += sz;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
if (space >= sz) {
|
||||||
|
error = copyout(&ifr, ifrp, sz);
|
||||||
|
if (error != 0)
|
||||||
|
return error;
|
||||||
|
ifrp++;
|
||||||
|
space -= sz;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IFADDR_FOREACH(ifa, ifp) {
|
IFADDR_FOREACH(ifa, ifp) {
|
||||||
|
@ -1735,27 +1733,23 @@ ifconf(u_long cmd, void *data)
|
||||||
/* all sockaddrs must fit in sockaddr_storage */
|
/* all sockaddrs must fit in sockaddr_storage */
|
||||||
KASSERT(sa->sa_len <= sizeof(ifr.ifr_ifru));
|
KASSERT(sa->sa_len <= sizeof(ifr.ifr_ifru));
|
||||||
|
|
||||||
if (ifrp != NULL)
|
if (ifrp == NULL) {
|
||||||
{
|
|
||||||
memcpy(&ifr.ifr_space, sa, sa->sa_len);
|
|
||||||
if (space >= sz) {
|
|
||||||
error = copyout(&ifr, ifrp, sz);
|
|
||||||
if (error != 0)
|
|
||||||
return (error);
|
|
||||||
ifrp++; space -= sz;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
space += sz;
|
space += sz;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
memcpy(&ifr.ifr_space, sa, sa->sa_len);
|
||||||
|
if (space >= sz) {
|
||||||
|
error = copyout(&ifr, ifrp, sz);
|
||||||
|
if (error != 0)
|
||||||
|
return (error);
|
||||||
|
ifrp++; space -= sz;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ifrp != NULL)
|
if (ifrp != NULL) {
|
||||||
{
|
|
||||||
KASSERT(0 <= space && space <= ifc->ifc_len);
|
KASSERT(0 <= space && space <= ifc->ifc_len);
|
||||||
ifc->ifc_len -= space;
|
ifc->ifc_len -= space;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
KASSERT(space >= 0);
|
KASSERT(space >= 0);
|
||||||
ifc->ifc_len = space;
|
ifc->ifc_len = space;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue