From owner-freebsd-firewire@FreeBSD.ORG Fri Aug 29 17:55:36 2008 Return-Path: Delivered-To: freebsd-firewire@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A85D1065689 for ; Fri, 29 Aug 2008 17:55:36 +0000 (UTC) (envelope-from sbruno@miralink.com) Received: from plato.miralink.com (mail.miralink.com [70.103.185.20]) by mx1.freebsd.org (Postfix) with ESMTP id 669638FC17 for ; Fri, 29 Aug 2008 17:55:36 +0000 (UTC) (envelope-from sbruno@miralink.com) Received: from localhost (localhost.localdomain [127.0.0.1]) by plato.miralink.com (Postfix) with ESMTP id AB6E91A91B6; Fri, 29 Aug 2008 10:45:51 -0700 (PDT) X-Virus-Scanned: amavisd-new at X-Spam-Flag: NO X-Spam-Score: -4.34 X-Spam-Level: X-Spam-Status: No, score=-4.34 tagged_above=-10 required=6.6 tests=[ALL_TRUSTED=-1.8, AWL=0.059, BAYES_00=-2.599] Received: from plato.miralink.com ([127.0.0.1]) by localhost (plato.miralink.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QoxJYfcPmccq; Fri, 29 Aug 2008 10:45:51 -0700 (PDT) Received: from [10.0.0.40] (iago.office.miralink.com [10.0.0.40]) by plato.miralink.com (Postfix) with ESMTP id 3F0011A91B5; Fri, 29 Aug 2008 10:45:51 -0700 (PDT) Message-ID: <48B83817.8050508@miralink.com> Date: Fri, 29 Aug 2008 10:55:35 -0700 From: Sean Bruno User-Agent: Thunderbird 2.0.0.16 (X11/20080723) MIME-Version: 1.0 To: Dieter References: <200808291626.QAA13259@sopwith.solgatos.com> In-Reply-To: <200808291626.QAA13259@sopwith.solgatos.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-firewire@freebsd.org Subject: Re: This is where I'm going with fwcontrol X-BeenThere: freebsd-firewire@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Firewire support in FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Aug 2008 17:55:36 -0000 Dieter wrote: > I looked at the changes NetBSD made to fwcontrol.c > with the idea of tweaking FreeBSD's version so it would > compile on both OSes. Below is a patch that might be enough. > They made more changes than this. Some are clearly not essential > (whitespace, putting the usage message into alphabetical order, ...), > some I'm not sure about so I left them out for now. The full set > of changes they did can be viewed by diffing FreeBSD cvs 1.23 > with NetBSD cvs 1.7. It still compiles fine on FreeBSD 7.0 amd64, > (and the getprogname() thing works) I haven't tried NetBSD yet. > > =================================================================== > RCS file: RCS/fwcontrol.c,v > retrieving revision 1.2.2.2 > diff -u -r1.2.2.2 fwcontrol.c > --- fwcontrol.c 2008/08/29 15:50:16 1.2.2.2 > +++ fwcontrol.c 2008/08/29 16:00:48 > @@ -32,8 +32,10 @@ > * SUCH DAMAGE. > */ > > +#if defined(__FreeBSD__) > #include > __FBSDID("$FreeBSD: src/usr.sbin/fwcontrol/fwcontrol.c,v 1.23.2.1 2008/05/02 06:15:58 simokawa Exp $"); > +#endif > > #include > #include > @@ -42,11 +44,22 @@ > #include > #include > #include > +#if defined(__FreeBSD__) > #include > #include > #include > #include > #include > +#elif defined(__NetBSD__) > +#include "eui64.h" > +#include > +#include > +#include > +#include > +#else > +#warning "You need to add support for your OS" > +#endif > + > > #include > #include > @@ -66,7 +79,7 @@ > usage(void) > { > fprintf(stderr, > - "fwcontrol [-u bus_num] [-prt] [-c node] [-d node] [-o node] [-s node]\n" > + "%s [-u bus_num] [-prt] [-c node] [-d node] [-o node] [-s node]\n" > "\t [-l file] [-g gap_count] [-f force_root ] [-b pri_req]\n" > "\t [-M mode] [-R filename] [-S filename] [-m EUI64 | hostname]\n" > "\t-u: specify bus number\n" > @@ -84,7 +97,8 @@ > "\t-M: specify dv or mpeg\n" > "\t-R: Receive DV or MPEG TS stream\n" > "\t-S: Send DV stream\n" > - "\t-m: set fwmem target\n"); > + "\t-m: set fwmem target\n" > + , getprogname() ); > exit(EX_USAGE); > } > > @@ -981,8 +995,16 @@ > if (set_fwmem_target) { > eui.hi = ntohl(*(u_int32_t*)&(target.octet[0])); > eui.lo = ntohl(*(u_int32_t*)&(target.octet[4])); > +#if defined(__FreeBSD__) > sysctl_set_int("hw.firewire.fwmem.eui64_hi", eui.hi); > sysctl_set_int("hw.firewire.fwmem.eui64_lo", eui.lo); > +#elif defined(__NetBSD__) > + sysctl_set_int("hw.fwmem.eui64_hi", eui.hi); > + sysctl_set_int("hw.fwmem.eui64_lo", eui.lo); > +#else > +#warning "You need to add support for your OS" > +#endif > + > } > > /* > Since my current patch-set is fairly extensive in it's current state, I'm going to defer application of this patch for a while. -- Sean Bruno MiraLink Corporation 6015 NE 80th Ave, Ste 100 Portland, OR 97218 Phone 503-621-5143 Fax 503-621-5199 MSN: sbruno@miralink.com Google: seanwbruno@gmail.com Yahoo: sean_bruno@yahoo.com