Date: Sun, 1 Apr 2001 23:29:27 -0700 (PDT) From: Matthew Jacob <mjacob@feral.com> To: Michael Richards <michael@fastmail.ca> Cc: freebsd-alpha@FreeBSD.ORG Subject: Re: Proposed Loader fix Message-ID: <Pine.BSF.4.21.0104012327170.14792-100000@beppo.feral.com> In-Reply-To: <3AC80BB8.000059.59989@frodo.searchcanada.ca>
next in thread | previous in thread | raw e-mail | index | archive | help
I think this is exactly what we've been looking for- but what we need is some
cross platform knowledge here. Asking the original author of this particular
module collection), Mike Smith (msmith@freebsd.org), might be really
beneficial.
On Mon, 2 Apr 2001, Michael Richards wrote:
> Hi.
>
> Hate to be polluting the list with babble about how my
> underpowered :) brain is working on what I thought would be a simple
> loader problem.
>
> Here is the problem:
> Every time open (in libstand) gets called, it must get info on the
> device through the devopen() call. The problem is, devopen() has no
> concept of whether the device is open or not so it blindly tries to
> open the device (even though it may already be open). This results in
> a call to prom_open which is causing the problems with some versions
> of SRM.
>
> My proposed solution is:
> Modify the devsw struct. Here is the original:
> /*
> * Device switch
> */
> struct devsw {
> const char dv_name[8];
> int dv_type; /* opaque type constant, arch-
> dependant */
> int (*dv_init)(void); /* early probe call */
> int (*dv_strategy)(void *devdata, int rw, daddr_t blk,
> size_t size,
> char *buf, size_t *rsize);
> int (*dv_open)(struct open_file *f, ...);
> int (*dv_close)(struct open_file *f);
> int (*dv_ioctl)(struct open_file *f, u_long cmd, void
> *data);
> void (*dv_print)(int verbose); /* print device
> information */
> void (*dv_cleanup)(void);
> };
>
> This appears to carry info about the device. So I say that I should
> be able to add a flag to it so it will not be opened multiple times.
> Portability? No idea. It might cause everything to blow up. I'm
> really new to modifying OS level source, let alone changing data
> structures so I'm not sure the proper procedure or if this struct
> should even be mucked with.
>
> int dv_opened;
>
> Set this to 0 on initialisation, set it to 1 on open and set it to 0
> on close. This way each device can be opened once and only once no
> matter how many dev_open calls.
>
> So this is my proposal. Feel free to comment on it. It will take a
> little hacking to get this change in, but if nobody takes exception
> to this, I'll do it and post patches.
>
> -Michael
> _________________________________________________________________
> http://fastmail.ca/ - Fast Free Web Email for Canadians
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0104012327170.14792-100000>
