bug-parted
[Top][All Lists]
Advanced

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

bug#15351: [PATCH 09/19] libparted: Avoid dasd as default disk type whil


From: Brian C. Lane
Subject: bug#15351: [PATCH 09/19] libparted: Avoid dasd as default disk type while probe
Date: Wed, 11 Sep 2013 12:24:59 -0700

From: Nageswara R Sastry <address@hidden>

This patch avoids setting 'dasd' as a default disk type for
'disk image file' at the time of probe.

Signed-off-by: Nageswara R Sastry <address@hidden>
---
 include/parted/fdasd.in.h | 1 +
 libparted/labels/fdasd.c  | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/parted/fdasd.in.h b/include/parted/fdasd.in.h
index 3692596..6f6a7e0 100644
--- a/include/parted/fdasd.in.h
+++ b/include/parted/fdasd.in.h
@@ -261,6 +261,7 @@ typedef struct fdasd_anchor {
        struct fdasd_hd_geometry geo;
        unsigned int label_block;
        unsigned int FBA_layout;
+       bool is_file;
 } fdasd_anchor_t;
 
 enum offset {lower, upper};
diff --git a/libparted/labels/fdasd.c b/libparted/labels/fdasd.c
index b58b2be..7de5f34 100644
--- a/libparted/labels/fdasd.c
+++ b/libparted/labels/fdasd.c
@@ -301,6 +301,7 @@ fdasd_initialize_anchor (fdasd_anchor_t * anc)
        }
        anc->hw_cylinders = 0;
        anc->formatted_cylinders = 0;
+       anc->is_file = 0;
 }
 
 /*
@@ -890,7 +891,7 @@ fdasd_check_volume (fdasd_anchor_t *anc, int fd)
                /* Some times LDL formatted disks does not
                   contain any volume label */
                return 1;
-       } else {
+       } else if (! anc->is_file) {
        /* didn't find VOL1 volume label */
                anc->formatted_cylinders = anc->hw_cylinders;
                anc->fspace_trk = anc->formatted_cylinders * anc->geo.heads
@@ -974,6 +975,7 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t 
*anc, int f)
            dasd_info.FBA_layout = 0;
            anc->hw_cylinders = ((st.st_size / blksize) / anc->geo.sectors) /
                                anc->geo.heads;
+           anc->is_file = 1;
        } else {
                if (ioctl(f, HDIO_GETGEO, &anc->geo) != 0)
                        fdasd_error(anc, unable_to_ioctl,
@@ -995,6 +997,8 @@ fdasd_get_geometry (const PedDevice *dev, fdasd_anchor_t 
*anc, int f)
                        anc->hw_cylinders = characteristics->long_no_cyl;
                else
                        anc->hw_cylinders = characteristics->no_cyl;
+
+               anc->is_file = 0;
        }
 
        anc->dev_type   = dasd_info.dev_type;
-- 
1.8.3.1






reply via email to

[Prev in Thread] Current Thread [Next in Thread]