Subject: Re: should readdisklabel be changed to return 'const char *'?
To: Martin Husemann <martin@duskware.de>
From: Jason Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 05/01/2003 12:38:09
On Thursday, May 1, 2003, at 10:17  AM, Martin Husemann wrote:

> 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.

I'd say it should be:

	* 0 for valid label found
	* ESRCH for no label found.  ESRCH + *errorMsg == NULL is not
	  an error (unlabeled disk), but ESRCH + *errorMsg != NULL is
	  an error (some evidence of a label, but it's corrupted).
	* any other errno value is an error, possibly augmented by
	  *errorMsg != NULL.

         -- Jason R. Thorpe <thorpej@wasabisystems.com>