retitle 122738 libfdisk doesn't grok /proc/partitions with DevFS
thanks

The problem is that even if DevFS is enabled, but not mounted,
/proc/partitions is in DevFS format, and libfdisk doesn't like it.

See the function get_part_info in
boot-floppies/utitlities/libfdisk/fdisk.c.

I have a function to work around the problem for IDE disks, but it
doens't handle SCSI at all:

static void maybe_translate_devfs_name(char *name)
{
    int is_ide = !strncmp("ide/", name, 4);
    /* If it's not a DevFS-style IDE or SCSI partition name, ignore it */
    if (is_ide || !(strncmp("scsi/", name, 5))) {
        int host, bus, target, lun;
        int len = strlen(name);
        int is_disc = len > 4 && !(strcmp(name+len-4, "disc"));
        char *partstr = "";
        if (is_disc)
            sscanf(name + is_ide ? 4 : 5, "host%d/bus%d/target%d/lun%d",
                   &host, &bus, &target, &lun);
        else
            sscanf(name + is_ide ? 4 : 5, "host%d/bus%d/target%d/lun%d/part%s",
                   &host, &bus, &target, &lun, &partstr);

        sprintf(name, "%cd%c%s", is_ide ? 'h' : 's',
                97 + bus*2 + target,
                is_disc ? "" : partstr);
    }
}


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to