[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Hurdextras-hackers] Device interface

From: James Morrison
Subject: Re: [Hurdextras-hackers] Device interface
Date: Fri, 17 Jan 2003 08:10:46 -0800 (PST)

--- James A Morrison <address@hidden> wrote:
>  Hi,
>   I've thought of how I would like the upper levels talk to the
> lower levels.  The obvious thing is that there needs to be at least
> two functions, read and write.  I think that these functions should be
> called though function pointers.  So, we would have

 some typedef stuff should be added
typedef struct dev* dev_t;
typedef struct packet* packet_t;
typedef struct ukernel_stuff* net_dev_t;

> struct dev 
> {
>       error_t *(start) (dev_t this);
>       error_t *(stop) (dev_t this);
>       error_t *(read) (dev_t this, packet_t to_rcv);
>       error_t *(write) (dev_t this, packet_t to_send);

 So, I didn't address the actual uKernel independence that Kotry wanted.
Here is the simplest solution:

       net_dev_t attributes; /* this pointer to a struct that has all the
information needed to use the ukernel interface to a device, e.g. the mach
port. */

 I would loe to make the stuff in net_dev_t be private, but I don't think
the hacks to make that work in C would be worth while.

> }
> struct packet
> {
>       size_t len;
>       char *data;
> }
> If something tries to write a packet that is too big then write can
> return E2BIG.
>  I'll look into some arp stuff tommorrow, I think we might need a third
> element into the packet struct that is char  *to.  I don't think it is
> needed for most applications to need more than a read and a write to the
> interface.  A third struct may be useful that contains the functionality
> of an interface, e.g. changing the mac address of a card, setting a hard
> mtu limit.
>  Other things that can be added to struct dev are a get_stats function,
> and set/get flags functions.
> I'm getting this mostly out of reading ethernet.c in pfinet.
> James A. Morrison

 Anyway, some stuff on setting up devices.
There should be a static function, that is 
dev_t setup_device (char *name);
this returns the devices associated with a name

 Have I confused anyone else?  I'm using hurdextras-hackers as a notebook that
other people can correct :)

James Morrison
   University of Waterloo
   Computer Science - Digital Hardware
   2B co-op

Anyone referring to this as 'Open Source' shall be eaten by a GNU

Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]