From owner-p4-projects@FreeBSD.ORG Wed Aug 11 22:52:01 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id BA151106567A; Wed, 11 Aug 2010 22:52:01 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DD031065672 for ; Wed, 11 Aug 2010 22:52:01 +0000 (UTC) (envelope-from anchie@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 4FE5F8FC0A for ; Wed, 11 Aug 2010 22:52:01 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o7BMq1QA042859 for ; Wed, 11 Aug 2010 22:52:01 GMT (envelope-from anchie@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o7BMq1LW042856 for perforce@freebsd.org; Wed, 11 Aug 2010 22:52:01 GMT (envelope-from anchie@FreeBSD.org) Date: Wed, 11 Aug 2010 22:52:01 GMT Message-Id: <201008112252.o7BMq1LW042856@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to anchie@FreeBSD.org using -f From: Ana Kukec To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 182278 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Aug 2010 22:52:02 -0000 http://p4web.freebsd.org/@@182278?ac=10 Change 182278 by anchie@anchie_malimis on 2010/08/11 22:51:13 Further cleanup, as suggested by Bjoern. Affected files ... .. //depot/projects/soc2009/anchie_send/send_0.2/sendd/os-freebsd/snd_freebsd.c#7 edit Differences ... ==== //depot/projects/soc2009/anchie_send/send_0.2/sendd/os-freebsd/snd_freebsd.c#7 (text+ko) ==== @@ -35,39 +35,21 @@ #include #include -#include - #include -#include - -#include - #include #include -#include -#include #include - +#include "snd_freebsd.h" +#include "../dbg.h" +#include "../os_specific.h" #include "../sendd_local.h" -#include "../os_specific.h" #include "../snd_proto.h" -#include "../dbg.h" -#include "snd_freebsd.h" #include #include -static int icmp6sock = -1; -static int sndsock = -1; - -#ifdef DEBUG -static struct dlog_desc dbg = { - .desc = "net", - .ctx = SENDD_NAME -}; -static char abuf[INET6_ADDRSTRLEN]; -#endif +static int sndsock = -1; /* Per-interface info */ struct snd_ifinfo { @@ -76,6 +58,7 @@ int ifidx; int snds; }; + static DEFINE_LIST_HEAD(ifaces); /* Data packet meta data */ @@ -88,17 +71,7 @@ extern int linux_rand_init(void); extern void linux_rand_fini(void); -int -os_specific_init(void) -{ - if (linux_rand_init() < 0 || freebsd_snd_init() < 0) { - return (-1); - } - - return (0); -} - -int +static int freebsd_snd_init(void) { if (list_empty(&ifaces)) { @@ -109,7 +82,7 @@ if ((sndsock = socket(PF_INET6, SOCK_RAW, IPPROTO_SEND)) < 0) { applog(LOG_ERR, "[%s:%d]: socket: %s", __func__, __LINE__, strerror(errno)); - return(-1); + return (-1); } else { applog(LOG_ERR, "%s: SEND socket created: fd=%d", __func__, sndsock); } @@ -117,6 +90,16 @@ return (0); } +int +os_specific_init(void) +{ + if (linux_rand_init() < 0 || freebsd_snd_init() < 0) { + return (-1); + } + + return (0); +} + void os_specific_fini(void) { @@ -157,7 +140,7 @@ if ((b = snd_get_buf()) == NULL) { goto done; } - + pi = sbuff_data(b); sbuff_advance(b, sizeof (*pi)); @@ -224,7 +207,7 @@ { struct snd_packet_info *pi; struct sockaddr_send sendsrc; - + if (drop) { snd_put_buf(b); return;