On Wed, Jul 02, 2003 at 01:22:26PM -0400, Pisupati, Ajay wrote:
> Hello Gents,
> question about what you want to use for format. when you call open,
> what do you want to do when there is only a filename?
> ,/etc/passwd
no, but this would probably work anyway.
> -OR-
> /etc/passwd
this.
> if it's the second one, then how do we differentiate between a path
> specification and a device specification?
well first ignore the code in the devicepath_* functions, its only a
demonstration of the API, its NOT a usuable implementation (except for
only the most naive case, and its probably usuable for our userspace
test version where we will just use simple things like
/dev/hda12,/etc/passwd).
the real implemenation of these functions will split each componant of
the path and test that they are valid in the OpenFirmware device tree
(i am not yet entirely certain how this will work).
so what i think we can reasonably do is if the first componant of the
path is invalid in the device-tree we will assume its a path relative
to the pwd (if you recall the default= device option will be
implemented by calling chdir("/whatever/default/OF/device");).
if the first componant of a path is valid, but any later part of it is
not we return ENXIO.
its not perfect, but i think its an acceptable compromise since its
fairly unlikly that unix filesystem namespace would collide with the
OF device tree.
we also need to do a canonicalization of aliases before acting on
anything. i need to check but i think OF's canon method will work for
this.
> The code in __ofpath right now looks for the rightmost comma and assumes
> everything before it is the device and after is filename.
yes its extremely naive, its not meant as a real implementation, just
as a very basic demonstration of how the api works.
> if we use the first method, then please note that __ofpath.c needs to be
> changed slightly.
not slightly, it needs to be rewritten.
i need to get around to doing that, i need to get some advice from an
OF expert first though.
also if you grab a copy of the IEEE1275 spec (available from OpenBIOS
web page) and read section 4.3 it describes how OF does its device
path parsing and resolution. we will need to use a proceedure very
close to this. (it includes some pseudocode).
--
Ethan Benson
http://www.alaska.net/~erbenson/
Attachment:
pgp00011.pgp
Description: PGP signature