Hi Ginnie,

> 
> Jean and I talked about this. The way the extended partition team wrote 
> their code they didn't centralize the error codes in one location. after 
> each return from libfdisk_init, there is a switch statement that 
> processes the return value.  You can see an example of this here  
> http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/boot/installgrub/installgrub.c#312.
>  
> 
> At the time of our discussion, we decided not to code it this way.  I'm 
> interested in your thoughts on this.

In looking at the way this is used in your pointer, it seems like we 
should modify our code to handle the cases where we have invalid 
geometry. The "no logical partition" error seems ok to continue from. 
The others seem like errors we should handle in a different way. What is 
the impact of continuing in your code if we cannot read the partition 
due to one of these errors?

So, my suggestion is something like this:

if ((rval = libfdisk_init(&epp, device_p0, NULL, FDISK_READ_DISK))
            != FDISK_SUCCESS) {

        switch (rval) {
                        /*
                         * there is no Solaris logical partition
                         */
                        case FDISK_EBADLOGDRIVE:
                        case FDISK_ENOLOGDRIVE:
                                continue;
                        case FDISK_ENOVGEOM:
                        case FDISK_ENOPGEOM:
                        case FDISK_ENOLGEOM:
                                /*
                                 * Do some error handling and return
                                 */
                                break;
                        default:
                                /*
                                 * libfdisk_init failed. Do some error
                                 * error handling and return.
                                 */
                                break;
        }

Would this work?

thanks,
sarah



Reply via email to