[prev in list] [next in list] [prev in thread] [next in thread] 

List:       evms-devel
Subject:    [Evms-devel] sanity check
From:       "Don Mulvey" <dlmulvey () us ! ibm ! com>
Date:       2001-11-05 17:04:55
[Download RAW message or body]

Hi Andrew,

As you know, I have been playing a bit with libparted and trying to run
through evms partition discovery by making libparted calls.   I have a bit
of code from the discovery piece that I wanted to show you.    In the
following code, a segment manager has been called by the evms engine to
discover partitions on a disk and create a partition list.   The code is
passed a storage object (type==disk) and is suppose to use the i/o routines
and geometry info provided by the disk storage object.   Ok?   The approach
is to build a PedDevice with the same info as the disk storage object and
then continue with the partition discovery process.   So,  I first get a
PedDevice from libparted and then fill in information  from the storage
object; most importantly:  geometry, size and read/write routines.    Then,
I call libparted to malloc a PedDisk,  ident the partition scheme, probe
the partition tables and attach a list of partitions to the PedDisk ...
that I hope to get back.    Currently, I am getting as far as read_table()
( in disk_dos.c  ) but then failing on partition checks.  I think it is due
to reported geometry and invalid partition allignment.   However,  I have a
very simple partition scheme, cylinder allingment, etc. and believe I am
simply not telling parted the correct info ... someplace.   The test disk
(C=827,H=64,S=63)  has 3 logical drives in an extended partition.
Libparted coughs right away ... doesnt like the extended partition record
in the mbr.    The  extended  starts (0,1,1)  and ends (8,63,63).   Could
you take a look and tell me if I am crazy or not?     Thanks,  Don


    sprintf(disk_name, "/dev/%s", ld->name);   // ld==disk storage object ... ld->name == hda, hdb, etc
    disk_pdata->ped_device = ped_device_get(disk_name);
    if (disk_pdata->ped_device) {  // disk_pdata == ld private data

        struct plugin_functions_s  *fncs = (struct plugin_functions_s *)ld->plugin->functions.plugin;

        EvmsSpecific               *evms = (EvmsSpecific *)disk_pdata->ped_device->arch_specific;

        evms->object      = (void *) ld;
        evms->size        = ld->size;
        evms->read        = fncs->read;
        evms->write       = fncs->write;

        disk_pdata->ped_device->open_count = 1;
        disk_pdata->ped_device->cylinders = ld->geometry.cylinders;
        disk_pdata->ped_device->heads     = ld->geometry.heads;
        disk_pdata->ped_device->sectors   = ld->geometry.sectors_per_track;
        disk_pdata->ped_device->geom_known = 1;
        disk_pdata->ped_device->length     = ld->size;

        disk_pdata->ped_disk = ped_disk_new (disk_pdata->ped_device);
        if (disk_pdata->ped_disk){
            parted_do_print(disk_pdata->ped_device, disk_pdata->ped_disk);
        }
        else {
            LOG_ERROR("error, ped_disk_new() failed\n");
            rc = -ENODEV;
        }
}


_______________________________________________
Evms-devel mailing list
Evms-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/evms-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic