FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 10-29-2009, 12:39 PM
Hans de Goede
 
Default libparted: add ped_disk_get_partition_alignment() function

This functions get the aligment needed for partition boundaries on this disk.
The returned alignment describes the aligment for the start sector of the
partition, for all disklabel types which require alignment, except Sun
disklabels, the end sector must be aligned too. To get the end sector
aligment decrease the PedAlignment offset by 1.
---
include/parted/disk.h | 2 ++
libparted/disk.c | 20 ++++++++++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/include/parted/disk.h b/include/parted/disk.h
index 46b5f28..76397a8 100644
--- a/include/parted/disk.h
+++ b/include/parted/disk.h
@@ -214,6 +214,7 @@ struct _PedDiskOps {
int (*get_max_primary_partition_count) (const PedDisk* disk);
bool (*get_max_supported_partition_count) (const PedDisk* disk,
int* supported);
+ PedAlignment *(*get_partition_alignment)(const PedDisk *disk);
};

struct _PedDiskType {
@@ -263,6 +264,7 @@ extern int ped_disk_get_last_partition_num (const PedDisk* disk);
extern int ped_disk_get_max_primary_partition_count (const PedDisk* disk);
extern bool ped_disk_get_max_supported_partition_count(const PedDisk* disk,
int* supported);
+extern PedAlignment *ped_disk_get_partition_alignment(const PedDisk *disk);

/** @} */

diff --git a/libparted/disk.c b/libparted/disk.c
index f3074a3..b93613e 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -686,6 +686,26 @@ ped_disk_get_max_supported_partition_count(const PedDisk* disk, int* supported)
}

/**
+ * Get the aligment needed for partition boundaries on this disk.
+ * The returned alignment describes the aligment for the start sector of the
+ * partition, for all disklabel types which require alignment, except Sun
+ * disklabels, the end sector must be aligned too. To get the end sector
+ * aligment decrease the PedAlignment offset by 1.
+ *
+ *
eturn NULL on error, otherwise a pointer to a dynamically allocated
+ * aligment.
+ */
+PedAlignment*
+ped_disk_get_partition_alignment(const PedDisk *disk)
+{
+ /* disklabel handlers which don't need alignment don't define this */
+ if (!disk->type->ops->get_partition_alignment)
+ return ped_alignment_duplicate(ped_alignment_any);
+
+ return disk->type->ops->get_partition_alignment(disk);
+}
+
+/**
* Get the maximum number of (primary) partitions the disk label supports.
*
* For example, MacIntosh partition maps can have different sizes,
--
1.6.5.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 10-29-2009, 02:26 PM
Hans de Goede
 
Default libparted: add ped_disk_get_partition_alignment() function

This functions get the alignment needed for partition boundaries on this disk.
The returned alignment describes the alignment for the start sector of the
partition, for all disklabel types which require alignment, except Sun
disklabels, the end sector must be aligned too. To get the end sector
alignment decrease the PedAlignment offset by 1.
---
include/parted/disk.h | 2 ++
libparted/disk.c | 20 ++++++++++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/include/parted/disk.h b/include/parted/disk.h
index 46b5f28..76397a8 100644
--- a/include/parted/disk.h
+++ b/include/parted/disk.h
@@ -214,6 +214,7 @@ struct _PedDiskOps {
int (*get_max_primary_partition_count) (const PedDisk* disk);
bool (*get_max_supported_partition_count) (const PedDisk* disk,
int* supported);
+ PedAlignment *(*get_partition_alignment)(const PedDisk *disk);
};

struct _PedDiskType {
@@ -263,6 +264,7 @@ extern int ped_disk_get_last_partition_num (const PedDisk* disk);
extern int ped_disk_get_max_primary_partition_count (const PedDisk* disk);
extern bool ped_disk_get_max_supported_partition_count(const PedDisk* disk,
int* supported);
+extern PedAlignment *ped_disk_get_partition_alignment(const PedDisk *disk);

/** @} */

diff --git a/libparted/disk.c b/libparted/disk.c
index f3074a3..60efc54 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -686,6 +686,26 @@ ped_disk_get_max_supported_partition_count(const PedDisk* disk, int* supported)
}

/**
+ * Get the alignment needed for partition boundaries on this disk.
+ * The returned alignment describes the alignment for the start sector of the
+ * partition, for all disklabel types which require alignment, except Sun
+ * disklabels, the end sector must be aligned too. To get the end sector
+ * alignment decrease the PedAlignment offset by 1.
+ *
+ *
eturn NULL on error, otherwise a pointer to a dynamically allocated
+ * alignment.
+ */
+PedAlignment*
+ped_disk_get_partition_alignment(const PedDisk *disk)
+{
+ /* disklabel handlers which don't need alignment don't define this */
+ if (!disk->type->ops->get_partition_alignment)
+ return ped_alignment_duplicate(ped_alignment_any);
+
+ return disk->type->ops->get_partition_alignment(disk);
+}
+
+/**
* Get the maximum number of (primary) partitions the disk label supports.
*
* For example, MacIntosh partition maps can have different sizes,
--
1.6.5.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 10-30-2009, 10:59 AM
Hans de Goede
 
Default libparted: add ped_disk_get_partition_alignment() function

This functions get the alignment needed for partition boundaries on this disk.
The returned alignment describes the alignment for the start sector of the
partition, for all disklabel types which require alignment, except Sun
disklabels, the end sector must be aligned too. To get the end sector
alignment decrease the PedAlignment offset by 1.
---
include/parted/disk.h | 2 ++
libparted/disk.c | 20 ++++++++++++++++++++
2 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/include/parted/disk.h b/include/parted/disk.h
index 46b5f28..76397a8 100644
--- a/include/parted/disk.h
+++ b/include/parted/disk.h
@@ -214,6 +214,7 @@ struct _PedDiskOps {
int (*get_max_primary_partition_count) (const PedDisk* disk);
bool (*get_max_supported_partition_count) (const PedDisk* disk,
int* supported);
+ PedAlignment *(*get_partition_alignment)(const PedDisk *disk);
};

struct _PedDiskType {
@@ -263,6 +264,7 @@ extern int ped_disk_get_last_partition_num (const PedDisk* disk);
extern int ped_disk_get_max_primary_partition_count (const PedDisk* disk);
extern bool ped_disk_get_max_supported_partition_count(const PedDisk* disk,
int* supported);
+extern PedAlignment *ped_disk_get_partition_alignment(const PedDisk *disk);

/** @} */

diff --git a/libparted/disk.c b/libparted/disk.c
index f3074a3..60efc54 100644
--- a/libparted/disk.c
+++ b/libparted/disk.c
@@ -686,6 +686,26 @@ ped_disk_get_max_supported_partition_count(const PedDisk* disk, int* supported)
}

/**
+ * Get the alignment needed for partition boundaries on this disk.
+ * The returned alignment describes the alignment for the start sector of the
+ * partition, for all disklabel types which require alignment, except Sun
+ * disklabels, the end sector must be aligned too. To get the end sector
+ * alignment decrease the PedAlignment offset by 1.
+ *
+ *
eturn NULL on error, otherwise a pointer to a dynamically allocated
+ * alignment.
+ */
+PedAlignment*
+ped_disk_get_partition_alignment(const PedDisk *disk)
+{
+ /* disklabel handlers which don't need alignment don't define this */
+ if (!disk->type->ops->get_partition_alignment)
+ return ped_alignment_duplicate(ped_alignment_any);
+
+ return disk->type->ops->get_partition_alignment(disk);
+}
+
+/**
* Get the maximum number of (primary) partitions the disk label supports.
*
* For example, MacIntosh partition maps can have different sizes,
--
1.6.5.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 12:41 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org