[PATCH parted 3/5] linux.c: add get_minimal_alignment() and get_optimal_alignment() functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 libparted/arch/linux.c |   34 +++++++++++++++++++++++++++++++++-
 1 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index d261a04..32e8af9 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2521,6 +2521,34 @@ linux_disk_commit (PedDisk* disk)
         return 1;
 }
 
+#if HAVE_BLKID_BLKID_H
+PedAlignment*
+linux_get_minimal_aligment(PedDevice* dev)
+{
+        blkid_topology tp = LINUX_SPECIFIC (dev)->topology;
+
+        if (!tp)
+                return NULL; /* ped_alignment_none */
+
+        return ped_alignment_new(
+                blkid_topology_get_alignment_offset(tp) / dev->sector_size,
+                blkid_topology_get_minimum_io_size(tp) / dev->sector_size);
+}
+
+PedAlignment*
+linux_get_optimal_aligment(PedDevice* dev)
+{
+        blkid_topology tp = LINUX_SPECIFIC (dev)->topology;
+
+        if (!tp)
+                return NULL; /* ped_alignment_none */
+
+        return ped_alignment_new(
+                blkid_topology_get_alignment_offset(tp) / dev->sector_size,
+                blkid_topology_get_optimal_io_size(tp) / dev->sector_size);
+}
+#endif
+
 static PedDeviceArchOps linux_dev_ops = {
         _new:           linux_new,
         destroy:        linux_destroy,
@@ -2534,7 +2562,11 @@ static PedDeviceArchOps linux_dev_ops = {
         check:          linux_check,
         sync:           linux_sync,
         sync_fast:      linux_sync_fast,
-        probe_all:      linux_probe_all
+        probe_all:      linux_probe_all,
+#if HAVE_BLKID_BLKID_H
+        get_minimal_aligment:	linux_get_minimal_aligment,
+        get_optimal_aligment:	linux_get_optimal_aligment,
+#endif
 };
 
 PedDiskArchOps linux_disk_ops =  {
-- 
1.6.5.1

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

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux