Begin to identify virtio devices. Actually change the partition type in
msdos lables (dcantrell).
This commit is contained in:
parent
744273ef7e
commit
6d2787e7d9
18
parted-1.8.8-dos-label-swap.patch
Normal file
18
parted-1.8.8-dos-label-swap.patch
Normal file
@ -0,0 +1,18 @@
|
||||
diff -up parted-1.8.8/libparted/labels/dos.c.swap parted-1.8.8/libparted/labels/dos.c
|
||||
--- parted-1.8.8/libparted/labels/dos.c.swap 2009-03-23 17:21:21.000000000 -1000
|
||||
+++ parted-1.8.8/libparted/labels/dos.c 2009-03-23 17:24:57.000000000 -1000
|
||||
@@ -1411,6 +1411,12 @@ msdos_partition_set_flag (PedPartition*
|
||||
dos_data->prep = state;
|
||||
return ped_partition_set_system (part, part->fs_type);
|
||||
|
||||
+ case PED_PARTITION_SWAP:
|
||||
+ if (state) {
|
||||
+ return ped_partition_set_system (part, ped_file_system_type_get("linux-swap"));
|
||||
+ }
|
||||
+ //break;
|
||||
+
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
diff -up parted-1.8.8/libparted/labels/gpt.c.swap parted-1.8.8/libparted/labels/gpt.c
|
||||
diff -up parted-1.8.8/libparted/labels/mac.c.swap parted-1.8.8/libparted/labels/mac.c
|
98
parted-1.8.8-virtio.patch
Normal file
98
parted-1.8.8-virtio.patch
Normal file
@ -0,0 +1,98 @@
|
||||
diff -ur parted-1.8.8/include/parted/device.h parted-1.8.8-vdX/include/parted/device.h
|
||||
--- parted-1.8.8/include/parted/device.h 2009-03-26 14:33:30.000000000 +0100
|
||||
+++ parted-1.8.8-vdX/include/parted/device.h 2009-03-26 14:52:07.000000000 +0100
|
||||
@@ -46,7 +46,8 @@
|
||||
PED_DEVICE_VIODASD = 10,
|
||||
PED_DEVICE_SX8 = 11,
|
||||
PED_DEVICE_DM = 12,
|
||||
- PED_DEVICE_XVD = 13
|
||||
+ PED_DEVICE_XVD = 13,
|
||||
+ PED_DEVICE_VIRTBLK = 14
|
||||
} PedDeviceType;
|
||||
|
||||
typedef struct _PedDevice PedDevice;
|
||||
diff -ur parted-1.8.8/libparted/arch/linux.c parted-1.8.8-vdX/libparted/arch/linux.c
|
||||
--- parted-1.8.8/libparted/arch/linux.c 2009-03-26 14:33:30.000000000 +0100
|
||||
+++ parted-1.8.8-vdX/libparted/arch/linux.c 2009-03-26 14:57:23.000000000 +0100
|
||||
@@ -299,7 +299,6 @@
|
||||
return (SX8_MAJOR1 <= major && major <= SX8_MAJOR2);
|
||||
}
|
||||
|
||||
-#ifdef ENABLE_DEVICE_MAPPER
|
||||
static int
|
||||
readFD (int fd, char **buf)
|
||||
{
|
||||
@@ -337,7 +336,7 @@
|
||||
}
|
||||
|
||||
static int
|
||||
-_is_dm_major (int major)
|
||||
+_is_major_type (int major, const char* type)
|
||||
{
|
||||
int fd;
|
||||
char* buf = NULL;
|
||||
@@ -371,7 +370,7 @@
|
||||
}
|
||||
|
||||
name = strrchr(line, ' ');
|
||||
- if (!name || strcmp(name+1, "device-mapper"))
|
||||
+ if (!name || strcmp(name+1, type))
|
||||
goto next;
|
||||
|
||||
maj = strtol(line, &name, 10);
|
||||
@@ -392,6 +391,19 @@
|
||||
}
|
||||
|
||||
static int
|
||||
+_is_virtblk_major (int major)
|
||||
+{
|
||||
+ return _is_major_type (major, "virtblk");
|
||||
+}
|
||||
+
|
||||
+#ifdef ENABLE_DEVICE_MAPPER
|
||||
+static int
|
||||
+_is_dm_major (int major)
|
||||
+{
|
||||
+ return _is_major_type (major, "device-mapper");
|
||||
+}
|
||||
+
|
||||
+static int
|
||||
_probe_dm_devices ()
|
||||
{
|
||||
DIR* mapper_dir;
|
||||
@@ -489,6 +501,8 @@
|
||||
} else if (_is_dm_major(dev_major)) {
|
||||
dev->type = PED_DEVICE_DM;
|
||||
#endif
|
||||
+ } else if (_is_virtblk_major(dev_major)) {
|
||||
+ dev->type = PED_DEVICE_VIRTBLK;
|
||||
} else if (dev_major == XVD_MAJOR && (dev_minor % 0x10 == 0)) {
|
||||
dev->type = PED_DEVICE_XVD;
|
||||
} else {
|
||||
@@ -1198,6 +1212,10 @@
|
||||
goto error_free_arch_specific;
|
||||
break;
|
||||
|
||||
+ case PED_DEVICE_VIRTBLK:
|
||||
+ if (!init_generic (dev, _("Virtio Block Device")))
|
||||
+ goto error_free_arch_specific;
|
||||
+ break;
|
||||
case PED_DEVICE_UNKNOWN:
|
||||
if (!init_generic (dev, _("Unknown")))
|
||||
goto error_free_arch_specific;
|
||||
diff -ur parted-1.8.8/parted/parted.c parted-1.8.8-vdX/parted/parted.c
|
||||
--- parted-1.8.8/parted/parted.c 2009-03-26 14:33:30.000000000 +0100
|
||||
+++ parted-1.8.8-vdX/parted/parted.c 2009-03-26 14:53:34.000000000 +0100
|
||||
@@ -1264,10 +1264,10 @@
|
||||
int has_free_arg = 0;
|
||||
int has_list_arg = 0;
|
||||
int has_num_arg = 0;
|
||||
- char* transport[14] = {"unknown", "scsi", "ide", "dac960",
|
||||
+ char* transport[15] = {"unknown", "scsi", "ide", "dac960",
|
||||
"cpqarray", "file", "ataraid", "i2o",
|
||||
"ubd", "dasd", "viodasd", "sx8", "dm",
|
||||
- "xvd"};
|
||||
+ "xvd", "virtblk"};
|
||||
char* peek_word;
|
||||
char* start;
|
||||
char* end;
|
10
parted.spec
10
parted.spec
@ -4,7 +4,7 @@
|
||||
Summary: The GNU disk partition manipulation program
|
||||
Name: parted
|
||||
Version: 1.8.8
|
||||
Release: 15%{?dist}
|
||||
Release: 16%{?dist}
|
||||
License: GPLv3+
|
||||
Group: Applications/System
|
||||
URL: http://www.gnu.org/software/parted
|
||||
@ -24,6 +24,8 @@ Patch10: %{name}-1.8.8-sparc-enableraid.patch
|
||||
Patch11: %{name}-1.8.8-avoid-none-stat.patch
|
||||
Patch12: %{name}-1.8.8-newgcc4.4.patch
|
||||
Patch13: %{name}-1.8.8-return-error-update-mode.patch
|
||||
Patch14: %{name}-1.8.8-virtio.patch
|
||||
Patch15: %{name}-1.8.8-dos-label-swap.patch
|
||||
|
||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: e2fsprogs-devel
|
||||
@ -74,6 +76,8 @@ Parted library, you need to install this package.
|
||||
%patch11 -p1 -b .avoid-none-stat
|
||||
%patch12 -p1 -b .newgcc4.4
|
||||
%patch13 -p1 -b .return-error-update-mode
|
||||
%patch14 -p1 -b .virtio
|
||||
%patch15 -p1 -b .dos-label-swap
|
||||
|
||||
%build
|
||||
%configure --enable-device-mapper --enable-selinux --disable-static
|
||||
@ -131,6 +135,10 @@ fi
|
||||
%{_exec_prefix}/%{_lib}/pkgconfig/libparted.pc
|
||||
|
||||
%changelog
|
||||
* Thu Mar 26 2009 Joel Granados <jgranado@redhat.com> - 1.8.8-15
|
||||
- Begin to identify virtio devices.
|
||||
- Actually change the partition type in msdos lables (dcantrell).
|
||||
|
||||
* Mon Mar 23 2009 Joel Granados <jgranado@redhat.com> - 1.8.8-14
|
||||
- Correct the behavior of upated_mode functions when the ASSERT fails (thx to hansg).
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user