Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Jun 2000 20:30:11 -0400
From:      "Vladimir N. Silyaev" <vsilyaev@mindspring.com>
To:        Coleman Kane <cokane@one.net>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Linux ioctls
Message-ID:  <20000621203011.A499@jupiter.delta.ny.us>

next in thread | raw e-mail | index | archive | help

In the FreeBSD after 4.0 Release, have ability to registrate new 
Linux -> FreeBSD ioctl's translators in the any part of the kernel code.

It's looks like this:

#define LINUX_IOCTL_SET(n,low,high) \
static linux_ioctl_function_t linux_ioctl_##n; \
static struct linux_ioctl_handler n##_handler = {linux_ioctl_##n, low, high }; \
SYSINIT(n##register, SI_SUB_KLD, SI_ORDER_MIDDLE, linux_ioctl_register_handler,
&n##_handler); \
SYSUNINIT(n##unregister, SI_SUB_KLD, SI_ORDER_MIDDLE, linux_ioctl_unregister_han
dler, &n##_handler);

I'm thinking that this stuff better to include in a some of the linux emulator 
headers.

and after that:
		     low       high
LINUX_IOCTL_SET(net, 0x8900, 0x89ff); /* handler declaration */

Linux ioctl's constants,

#define LINUX_SIOCSIFADDR       0x8916          /* set PA address       */
#define LINUX_SIOCSIFFLAGS      0x8914          /* set flags            */
#define LINUX_SIOCSIFBR         0x8941          /* Set bridging options */

Translator implementation,

static int
linux_ioctl_net(struct proc *p,  struct linux_ioctl_args *args)
{
    int error=ENOIOCTL;
    DEB(printf(__FUNCTION__ ": cmd 0x%04lx arg %p\n", args->cmd, (void*)args->ar
g));
    switch (args->cmd & 0xffff) {
		case LINUX_SIOCSIFFLAGS:
                    args->cmd = SIOCSIFFLAGS;
                    error = ioctl(p, (struct ioctl_args *)args);
                    break;
                case LINUX_SIOCSIFADDR:
                    args->cmd = SIOCSIFADDR;
                    error = ioctl(p, (struct ioctl_args *)args);
                    break;
                case LINUX_SIOCSIFBR:
                    args->cmd = VMIO_SIOCSIFBR;
                    error = ioctl(p, (struct ioctl_args *)args);
                    break;
...
   }
   DEB(printf(__FUNCTION__ ": return %d\n", error));
   return (error);
}


As far as I know such thing now are used only in linux emulator code and in
the FreeBSD drivers for vmware.

--
Vladimir
 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000621203011.A499>