From owner-freebsd-alpha Sun Apr 1 22:19:14 2001 Delivered-To: freebsd-alpha@freebsd.org Received: from mail.interchange.ca (ns.interchange.ca [216.126.79.2]) by hub.freebsd.org (Postfix) with ESMTP id 9395937B71B for ; Sun, 1 Apr 2001 22:19:10 -0700 (PDT) (envelope-from michael@fastmail.ca) Received: by mail.interchange.ca (Fastmailer, from userid 555) id 3091220DA; Mon, 2 Apr 2001 01:18:48 -0400 (EDT) MIME-Version: 1.0 Message-Id: <3AC80BB8.000059.59989@frodo.searchcanada.ca> Content-Type: Multipart/Mixed; boundary="------------Boundary-00=_C3G5WYN2Q7BNTT4D7TH0" To: freebsd-alpha@FreeBSD.ORG Subject: Proposed Loader fix Cc: mjacob@feral.com From: "Michael Richards" X-Fastmail-IP: 24.43.130.237 Date: Mon, 2 Apr 2001 01:18:48 -0400 (EDT) Sender: owner-freebsd-alpha@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org --------------Boundary-00=_C3G5WYN2Q7BNTT4D7TH0 Content-Type: Text/Plain Content-Transfer-Encoding: 7bit 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 --------------Boundary-00=_C3G5WYN2Q7BNTT4D7TH0-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message