Subject: Re: should readdisklabel be changed to return 'const char *'?
To: Martin Husemann <email@example.com>
From: David Laight <firstname.lastname@example.org>
Date: 05/01/2003 18:36:04
On Thu, May 01, 2003 at 07:17:42PM +0200, Martin Husemann wrote:
> On Thu, May 01, 2003 at 05:48:48PM +0100, David Laight wrote:
> > However since almost all the returned strings are literals
> > it should really be:
> > const char *readdisklabel(dev_t, void (*)(struct buf *),
> > struct disklabel *, struct cpu_disklabel *);
> Seeing Jason fight for removing "no disk label" error messages
> it should probably be
> int readdisklabel(dev_t, void (*)(struct buf *),
> struct disklabel *, struct cpu_disklabel *, const char **errorMsg);
> and return -1 if no label was found, 0 if everything is OK and some error
> code (plus setting *errorMsg) if something went wrong.
All the code I've found ignores the error condition (ok it prints a message
then continues) .
The other options is to use the empty string "" to mean 'I didn't actually
find a disklabel'. However if no disklabel is found one is usually
created with an entry for the entire disk.
(I'm currently hacking the i386 one to fill in all the mbr partitions
in this case.)
 For some reason vnd calls it twice!
David Laight: email@example.com