Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Feb 1997 16:07:30 +1030 (CST)
From:      Michael Smith <msmith@atrad.adelaide.edu.au>
To:        mcgovern@spoon.beta.com (Brian J. McGovern)
Cc:        hackers@freebsd.org
Subject:   Re: Device Driver: Almost home(?)
Message-ID:  <199702020537.QAA15620@genesis.atrad.adelaide.edu.au>
In-Reply-To: <199702020327.WAA00333@spoon.beta.com> from "Brian J. McGovern" at "Feb 1, 97 10:27:51 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Brian J. McGovern stands accused of saying:
> 
> Ok. I've collated a half dozen responses, and merged them in to what I hope
> is less of a Frankenstein. At this point, I've modified files.i386, and moved
> foo.c in to /usr/src/sys/dev/foo/foo.c. I've added a "pseudo-device foo 1"

You shouldn't be modifying files.i386 if the file isn't in the i386
tree.  You should be modifying /sys/conf/files as I previously
mentioned.

> its making it in there. However, I don't think fooinit() is being run
> properly, and I'm not sure of the call I make to register the device. As 
> before, if someone can sanity check me, and let me take it a step or two
> further, I'd appreciate it. I think that once I can get it to where I can
> tinker and debug, I should be set. 

Do you see your printf at startup?

> Also, I'm getting a warning about the SYSINIT macro, stating
> "warning: initialization from incompatible pointer type". If someone could
> give me a lead on that as well, I'd appreciate it.
...
> static void fooinit(void)

That should be

static void
fooinit(void *unused)

as per the example I referenced in /sys/dev/vn/vn.c

> static int fooread(dev,myuio, flag)
>   dev_t dev;
>   struct uio *myuio;
>   int flag;
>   {
>     unsigned char *buffer_pointer;
>     int toread;
>     if ((myuio->uio_iovcnt != 1) || (minor(dev) != 0))
>       return ENODEV;
>     while(myuio->uio_resid)
>       {
>         buffer_pointer = (message + (myuio->uio_offset % sizeof(message)));
>         toread = ((long unsigned int)(message + sizeof(message)) - (long unsigned int)buffer_pointer);
>         uiomove(buffer_pointer, toread, myuio);
> 	myuio->uio_offset + toread;
> 	myuio->uio_resid = myuio->uio_resid - toread;
>       }
>     return 0;
>   }

This is still complete rubbish; please see my earlier message. 8)

> 	-Brian

-- 
]] Mike Smith, Software Engineer        msmith@gsoft.com.au             [[
]] Genesis Software                     genesis@gsoft.com.au            [[
]] High-speed data acquisition and      (GSM mobile)     0411-222-496   [[
]] realtime instrument control.         (ph)          +61-8-8267-3493   [[
]] Unix hardware collector.             "Where are your PEZ?" The Tick  [[



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