[parted-devel] issue while resizing

Lisa Vitolo syn.shainer at gmail.com
Mon Aug 27 23:05:04 UTC 2012


Hello,

sorry, I didn't realize this: I thought a nopaste link with highlighting
would be easier to examine. This is my code, and I hope the comments I
added are clear enough for you to understand my issue.

/* NOTE: the filesystem is resized before the partition if the size is
decreasing; the filesystem is resized after the partition if the size is
increased */
void ResizeHelper::resizePartition(const QString& diskName, const QString&
partitionName, qulonglong size) /* the new size here is in bytes */
{
    int partitionNum = partitionName.right(1).toInt(); /* this gets the
partition number, like 4 for /dev/sda4 */
    long long int sectorSize = size / 512; /* for now I use a constant,
which is good for the disk I'm testing this code on, but I'm going to
compute the actual value here */

    ped_device_probe_all();

    PedDevice* device = ped_device_get( diskName.toUtf8().data() );
    PedDisk* disk = ped_disk_new(device);
    PedPartition* partition = ped_disk_get_partition(disk, partitionNum);
    PedGeometry geometry = partition->geom;

    PedGeometry* newGeometry = ped_geometry_new(device, geometry.start,
sectorSize);
    PedConstraint* constraint = ped_constraint_exact(newGeometry);

    if (ped_disk_set_partition_geom(disk, partition, constraint,
newGeometry->start, newGeometry->start + newGeometry->length - 1) == 0) {
        qDebug() << "error"; /* this isn't displayed */
    }

   /* calls to _destroy functions here */
}

Lisa


2012/8/28 Håkon Løvdal <hlovdal at gmail.com>
>
> Imagine that say 2 years from now, some person wants to study an open
> source/free
> software project and selects parted. Archives of the mailing list will
> now be in an
> incomplete state because parts of it was "outsourced" to places no
> longer existing.
> This is not good, so please post all details directly to the mailing list.
>
> BR Håkon Løvdal
>
> PS
> In addition, by posting a link you are setting a higher barrier for
people to
> answer you, so it is also in your direct interest to post to the list.

--
They say a little knowledge is a dangerous thing, but it's not one half so
bad as a lot of ignorance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20120828/de4922d3/attachment.html>


More information about the parted-devel mailing list