From owner-freebsd-alpha Sun Apr 1 23:29:33 2001 Delivered-To: freebsd-alpha@freebsd.org Received: from feral.com (feral.com [192.67.166.1]) by hub.freebsd.org (Postfix) with ESMTP id 94B1D37B71F for ; Sun, 1 Apr 2001 23:29:29 -0700 (PDT) (envelope-from mjacob@feral.com) Received: from beppo (beppo [192.67.166.79]) by feral.com (8.9.3/8.9.3) with ESMTP id XAA26714; Sun, 1 Apr 2001 23:29:33 -0700 Date: Sun, 1 Apr 2001 23:29:27 -0700 (PDT) From: Matthew Jacob Reply-To: mjacob@feral.com To: Michael Richards Cc: freebsd-alpha@FreeBSD.ORG Subject: Re: Proposed Loader fix In-Reply-To: <3AC80BB8.000059.59989@frodo.searchcanada.ca> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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