From owner-freebsd-multimedia@FreeBSD.ORG Tue Jan 11 14:59:20 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 250B3106564A; Tue, 11 Jan 2011 14:59:20 +0000 (UTC) (envelope-from fbsd@opal.com) Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) by mx1.freebsd.org (Postfix) with ESMTP id CD1B98FC22; Tue, 11 Jan 2011 14:59:19 +0000 (UTC) Received: from pool-141-154-232-8.bos.east.verizon.net ([141.154.232.8] helo=homobox.opal.com) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1PcfB0-0003MF-95; Tue, 11 Jan 2011 14:26:22 +0000 Received: from opal.com (localhost [IPv6:::1]) (authenticated bits=0) by homobox.opal.com (8.14.4/8.14.4) with ESMTP id p0BEQFUN063166 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 11 Jan 2011 09:26:15 -0500 (EST) (envelope-from fbsd@opal.com) Received: from shibato.opal.com ([2001:5c0:1100:f103:221:63ff:fe5a:c9a7] helo=shibato.opal.com) with IPv6:587 by opal.com; 11 Jan 2011 09:26:15 -0500 X-Mail-Handler: MailHop Outbound by DynDNS X-Originating-IP: 141.154.232.8 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/mailhop/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX18B28qZ/R6JW2r8Y8v6GAs+ Date: Tue, 11 Jan 2011 09:26:09 -0500 From: "J.R. Oldroyd" To: Hans Petter Selasky Message-ID: <20110111092609.7bf82016@shibato.opal.com> In-Reply-To: <201101110947.46399.hselasky@c2i.net> References: <20091204223126.00005392@unknown> <201001081650.14189.hselasky@c2i.net> <20100108114130.1cfe88c5@shibato.opal.com> <201101110947.46399.hselasky@c2i.net> X-Mailer: Claws Mail 3.7.6 (GTK+ 2.20.1; amd64-portbld-freebsd8.1) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/YhisAVz+wRfmBxJsPoke_AO"; protocol="application/pgp-signature" Cc: freebsd-multimedia@freebsd.org, emulation@freebsd.org, Alexander Leidinger Subject: Re: FYI: v4l-linuxulator support in FreeBSD-current now X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 11 Jan 2011 14:59:20 -0000 --Sig_/YhisAVz+wRfmBxJsPoke_AO Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Tue, 11 Jan 2011 09:47:46 +0100, Hans Petter Selasky = wrote: > > Hi, >=20 > I've received the following patch for my cuse4bsd module. Could this be=20 > included in the kernel's linux.ko ? This patch allows for linux DVB=20 > applications running under FreeBSD linux emulation. >=20 > --HPS >=20 > Index: cuse4bsd_kmod.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- cuse4bsd_kmod.c (revision 1700) > +++ cuse4bsd_kmod.c (working copy) > @@ -1689,3 +1689,49 @@ > =20 > return (0); > } > + > + > +#include > +#if defined (__amd64__) > +#include > +#include > +#else > +#include > +#include > +#endif > + > +#include > +MODULE_DEPEND(cuse4bsd, linux, 1, 1, 1); > + > +#define DVB_LINUX_IOCTL_MIN 0x6f00 > +#define DVB_LINUX_IOCTL_MAX 0x6fff > + > + > +static linux_ioctl_function_t cuse4bsd_linux_ioctl; > +static struct linux_ioctl_handler cuse4bsd_linux_handler =3D=20 > + {cuse4bsd_linux_ioctl, DVB_LINUX_IOCTL_MIN, DVB_LINUX_IOCTL_MAX}; > + > +SYSINIT (cuse4bsd_linux_register, SI_SUB_KLD, SI_ORDER_MIDDLE,=20 > + linux_ioctl_register_handler, &cuse4bsd_linux_handler); > +SYSUNINIT(cuse4bsd_linux_unregister, SI_SUB_KLD, SI_ORDER_MIDDLE,=20 > + linux_ioctl_unregister_handler, &cuse4bsd_linux_handler); > + > +static int > +cuse4bsd_linux_ioctl(struct thread *td, struct linux_ioctl_args *args) > +{ > + unsigned long cmd; > + > + /* swap the read/write bits, due to differences in bsd & linux ioctls*/ > + cmd =3D (unsigned long)args->cmd; > + if (cmd & (0x40 << 24)) { > + cmd &=3D 0xffffff; > + cmd |=3D (0x80 << 24); > + } else if (cmd & (0x80 << 24)) { > + cmd &=3D 0xffffff; > + cmd |=3D (0x40 << 24); > + } > + args->cmd =3D (l_uint)cmd; > + =20 > + /* Pass the ioctl off to our standard handler, now that its valid */ > + return(ioctl(td, (struct ioctl_args *)args)); > +} This patch merely flips the cmd bits. I'm not familiar with the Linux DVB ioctls... is it really the case that none of the data structures have 32/64-bit architecture dependent field sizes? Great if that's the case, but if not, we need to do data structure conversions here too, as we did for V4L. -jr --Sig_/YhisAVz+wRfmBxJsPoke_AO Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAk0saIIACgkQls33urr0k4nb5gCgo3c7uYK0K6p9dOTMPGq89skW SI4AoKZQg86SORlN9iskjoYl8oG09LHG =p6F8 -----END PGP SIGNATURE----- --Sig_/YhisAVz+wRfmBxJsPoke_AO--