Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 232119 Details for
Bug 320563
>=sys-apps/parted-1.9.0 does not always inform kernel of partition changes
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
extract of important git patches from 2010/05/10
parted-2.2-git20100510.patch (text/plain), 38.50 KB, created by
Andreas Kinzler
on 2010-05-19 16:58:44 UTC
(
hide
)
Description:
extract of important git patches from 2010/05/10
Filename:
MIME Type:
Creator:
Andreas Kinzler
Created:
2010-05-19 16:58:44 UTC
Size:
38.50 KB
patch
obsolete
>diff -urN orig/configure parted-2.2.1/configure >--- orig/configure 2010-02-26 15:25:45.000000000 +0100 >+++ parted-2.2.1/configure 2010-05-19 17:41:49.000000000 +0200 >@@ -562,8 +562,8 @@ > # Identity of this package. > PACKAGE_NAME='GNU parted' > PACKAGE_TARNAME='parted' >-PACKAGE_VERSION='2.2' >-PACKAGE_STRING='GNU parted 2.2' >+PACKAGE_VERSION='2.2.1' >+PACKAGE_STRING='GNU parted 2.2.1' > PACKAGE_BUGREPORT='bug-parted@gnu.org' > PACKAGE_URL='http://www.gnu.org/software/parted/' > >@@ -3599,7 +3599,7 @@ > > # Define the identity of the package. > PACKAGE='parted' >- VERSION='2.2' >+ VERSION='2.2.1' > > > cat >>confdefs.h <<_ACEOF >diff -urN orig/include/parted/debug.h parted-2.2.1/include/parted/debug.h >--- orig/include/parted/debug.h 2010-02-08 07:48:18.000000000 +0100 >+++ parted-2.2.1/include/parted/debug.h 2010-05-19 17:10:29.000000000 +0200 >@@ -39,7 +39,7 @@ > > #define PED_DEBUG(level, ...) \ > ped_debug ( level, __FILE__, __LINE__, __PRETTY_FUNCTION__, \ >- __VA_ARGS__ ); >+ __VA_ARGS__ ) > > #define PED_ASSERT(cond, action) \ > do { \ >@@ -79,8 +79,8 @@ > > #else /* !DEBUG */ > >-#define PED_ASSERT(cond, action) while (0) {} >-#define PED_DEBUG(level, ...) while (0) {} >+#define PED_ASSERT(cond, action) do {} while (0) >+#define PED_DEBUG(level, ...) do {} while (0) > > > #endif /* DEBUG */ >diff -urN orig/include/parted/device.h parted-2.2.1/include/parted/device.h >--- orig/include/parted/device.h 2010-01-15 20:17:37.000000000 +0100 >+++ parted-2.2.1/include/parted/device.h 2010-05-19 18:19:18.000000000 +0200 >@@ -46,7 +46,9 @@ > PED_DEVICE_DM = 12, > PED_DEVICE_XVD = 13, > PED_DEVICE_SDMMC = 14, >- PED_DEVICE_VIRTBLK = 15 >+ PED_DEVICE_VIRTBLK = 15, >+ PED_DEVICE_AOE = 16, >+ PED_DEVICE_MD = 17 > } PedDeviceType; > > typedef struct _PedDevice PedDevice; >@@ -144,7 +146,7 @@ > extern int ped_device_sync_fast (PedDevice* dev); > extern PedSector ped_device_check (PedDevice* dev, void* buffer, > PedSector start, PedSector count); >-extern PedConstraint* ped_device_get_constraint (PedDevice* dev); >+extern PedConstraint* ped_device_get_constraint (const PedDevice* dev); > > extern PedConstraint *ped_device_get_minimal_aligned_constraint( > const PedDevice *dev); >diff -urN orig/include/parted/disk.h parted-2.2.1/include/parted/disk.h >--- orig/include/parted/disk.h 2010-02-08 07:48:18.000000000 +0100 >+++ parted-2.2.1/include/parted/disk.h 2010-05-19 17:28:44.000000000 +0200 >@@ -68,10 +68,11 @@ > PED_PARTITION_PREP=10, > PED_PARTITION_MSFT_RESERVED=11, > PED_PARTITION_BIOS_GRUB=12, >- PED_PARTITION_APPLE_TV_RECOVERY=13 >+ PED_PARTITION_APPLE_TV_RECOVERY=13, >+ PED_PARTITION_DIAG=14 > }; > #define PED_PARTITION_FIRST_FLAG PED_PARTITION_BOOT >-#define PED_PARTITION_LAST_FLAG PED_PARTITION_APPLE_TV_RECOVERY >+#define PED_PARTITION_LAST_FLAG PED_PARTITION_DIAG > > enum _PedDiskTypeFeature { > PED_DISK_TYPE_EXTENDED=1, /**< supports extended partitions */ >diff -urN orig/libparted/arch/linux.c parted-2.2.1/libparted/arch/linux.c >--- orig/libparted/arch/linux.c 2010-02-22 09:04:53.000000000 +0100 >+++ parted-2.2.1/libparted/arch/linux.c 2010-05-19 18:19:42.000000000 +0200 >@@ -19,7 +19,7 @@ > > #include <config.h> > #include <arch/linux.h> >- >+#include <linux/blkpg.h> > #include <parted/parted.h> > #include <parted/debug.h> > #if defined __s390__ || defined __s390x__ >@@ -249,11 +249,13 @@ > #define UBD_MAJOR 98 > #define DASD_MAJOR 94 > #define VIODASD_MAJOR 112 >+#define AOE_MAJOR 152 > #define SX8_MAJOR1 160 > #define SX8_MAJOR2 161 > #define XVD_MAJOR 202 > #define SDMMC_MAJOR 179 > #define LOOP_MAJOR 7 >+#define MD_MAJOR 9 > > #define SCSI_BLK_MAJOR(M) ( \ > (M) == SCSI_DISK0_MAJOR \ >@@ -540,6 +542,8 @@ > dev->type = PED_DEVICE_DAC960; > } else if (dev_major == ATARAID_MAJOR && (dev_minor % 0x10 == 0)) { > dev->type = PED_DEVICE_ATARAID; >+ } else if (dev_major == AOE_MAJOR && (dev_minor % 0x10 == 0)) { >+ dev->type = PED_DEVICE_AOE; > } else if (dev_major == DASD_MAJOR && (dev_minor % 0x4 == 0)) { > dev->type = PED_DEVICE_DASD; > } else if (dev_major == VIODASD_MAJOR && (dev_minor % 0x8 == 0)) { >@@ -571,6 +575,8 @@ > dev->type = PED_DEVICE_VIRTBLK; > } else if (dev_major == LOOP_MAJOR) { > dev->type = PED_DEVICE_FILE; >+ } else if (dev_major == MD_MAJOR) { >+ dev->type = PED_DEVICE_MD; > } else { > dev->type = PED_DEVICE_UNKNOWN; > } >@@ -684,16 +690,6 @@ > dev->sector_size = PED_SECTOR_SIZE_DEFAULT; > } > #endif >- >- if (dev->sector_size != PED_SECTOR_SIZE_DEFAULT) { >- ped_exception_throw ( >- PED_EXCEPTION_WARNING, >- PED_EXCEPTION_OK, >- _("Device %s has a logical sector size of %lld. Not " >- "all parts of GNU Parted support this at the moment, " >- "and the working code is HIGHLY EXPERIMENTAL.\n"), >- dev->path, dev->sector_size); >- } > } > > static int >@@ -1313,6 +1309,11 @@ > goto error_free_arch_specific; > break; > >+ case PED_DEVICE_AOE: >+ if (!init_generic (dev, _("ATA over Ethernet Device"))) >+ goto error_free_arch_specific; >+ break; >+ > #if defined __s390__ || defined __s390x__ > case PED_DEVICE_DASD: > if (!init_dasd (dev, _("IBM S390 DASD drive"))) >@@ -1383,6 +1384,11 @@ > goto error_free_arch_specific; > break; > >+ case PED_DEVICE_MD: >+ if (!init_generic(dev, _("Linux Software RAID Array"))) >+ goto error_free_arch_specific; >+ break; >+ > default: > ped_exception_throw (PED_EXCEPTION_NO_FEATURE, > PED_EXCEPTION_CANCEL, >@@ -2299,6 +2305,268 @@ > return 0; > } > >+static int >+_blkpg_part_command (PedDevice* dev, struct blkpg_partition* part, int op) >+{ >+ LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev); >+ struct blkpg_ioctl_arg ioctl_arg; >+ >+ ioctl_arg.op = op; >+ ioctl_arg.flags = 0; >+ ioctl_arg.datalen = sizeof (struct blkpg_partition); >+ ioctl_arg.data = (void*) part; >+ >+ return ioctl (arch_specific->fd, BLKPG, &ioctl_arg) == 0; >+} >+ >+static int >+_blkpg_add_partition (PedDisk* disk, const PedPartition *part) >+{ >+ struct blkpg_partition linux_part; >+ const char* vol_name; >+ char* dev_name; >+ >+ PED_ASSERT(disk != NULL, return 0); >+ PED_ASSERT(disk->dev->sector_size % PED_SECTOR_SIZE_DEFAULT == 0, >+ return 0); >+ >+ if (!_has_partitions (disk)) >+ return 0; >+ >+ if (ped_disk_type_check_feature (disk->type, >+ PED_DISK_TYPE_PARTITION_NAME)) >+ vol_name = ped_partition_get_name (part); >+ else >+ vol_name = NULL; >+ >+ dev_name = _device_get_part_path (disk->dev, part->num); >+ if (!dev_name) >+ return 0; >+ >+ memset (&linux_part, 0, sizeof (linux_part)); >+ linux_part.start = part->geom.start * disk->dev->sector_size; >+ /* see fs/partitions/msdos.c:msdos_partition(): "leave room for LILO" */ >+ if (part->type & PED_PARTITION_EXTENDED) >+ linux_part.length = part->geom.length == 1 ? 512 : 1024; >+ else >+ linux_part.length = part->geom.length * disk->dev->sector_size; >+ linux_part.pno = part->num; >+ strncpy (linux_part.devname, dev_name, BLKPG_DEVNAMELTH); >+ if (vol_name) >+ strncpy (linux_part.volname, vol_name, BLKPG_VOLNAMELTH); >+ >+ free (dev_name); >+ >+ if (!_blkpg_part_command (disk->dev, &linux_part, >+ BLKPG_ADD_PARTITION)) { >+ return ped_exception_throw ( >+ PED_EXCEPTION_ERROR, >+ PED_EXCEPTION_IGNORE_CANCEL, >+ _("Error informing the kernel about modifications to " >+ "partition %s -- %s. This means Linux won't know " >+ "about any changes you made to %s until you reboot " >+ "-- so you shouldn't mount it or use it in any way " >+ "before rebooting."), >+ linux_part.devname, >+ strerror (errno), >+ linux_part.devname) >+ == PED_EXCEPTION_IGNORE; >+ } >+ >+ return 1; >+} >+ >+static int >+_blkpg_remove_partition (PedDisk* disk, int n) >+{ >+ struct blkpg_partition linux_part; >+ >+ if (!_has_partitions (disk)) >+ return 0; >+ >+ memset (&linux_part, 0, sizeof (linux_part)); >+ linux_part.pno = n; >+ return _blkpg_part_command (disk->dev, &linux_part, >+ BLKPG_DEL_PARTITION); >+} >+ >+/* >+ * The number of partitions that a device can have depends on the kernel. >+ * If we don't find this value in /sys/block/DEV/range, we will use our own >+ * value. >+ */ >+static unsigned int >+_device_get_partition_range(PedDevice* dev) >+{ >+ int range, r; >+ char path[128]; >+ FILE* fp; >+ bool ok; >+ >+ r = snprintf(path, sizeof(path), "/sys/block/%s/range", >+ last_component(dev->path)); >+ if (r < 0 || r >= sizeof(path)) >+ return MAX_NUM_PARTS; >+ >+ fp = fopen(path, "r"); >+ if (!fp) >+ return MAX_NUM_PARTS; >+ >+ ok = fscanf(fp, "%d", &range) == 1; >+ fclose(fp); >+ >+ /* (range <= 0) is none sense.*/ >+ return ok && range > 0 ? range : MAX_NUM_PARTS; >+} >+ >+/* >+ * Sync the partition table in two step process: >+ * 1. Remove all of the partitions from the kernel's tables, but do not attempt >+ * removal of any partition for which the corresponding ioctl call fails. >+ * 2. Add all the partitions that we hold in disk, throwing a warning >+ * if we cannot because step 1 failed to remove it and it is not being >+ * added back with the same start and length. >+ * >+ * To achieve this two step process we must calculate the minimum number of >+ * maximum possible partitions between what linux supports and what the label >+ * type supports. EX: >+ * >+ * number=MIN(max_parts_supported_in_linux,max_parts_supported_in_msdos_tables) >+ */ >+static int >+_disk_sync_part_table (PedDisk* disk) >+{ >+ PED_ASSERT(disk != NULL, return 0); >+ PED_ASSERT(disk->dev != NULL, return 0); >+ int lpn; >+ >+ /* lpn = largest partition number. */ >+ if (ped_disk_get_max_supported_partition_count(disk, &lpn)) >+ lpn = PED_MIN(lpn, _device_get_partition_range(disk->dev)); >+ else >+ lpn = _device_get_partition_range(disk->dev); >+ >+ /* Its not possible to support largest_partnum < 0. >+ * largest_partnum == 0 would mean does not support partitions. >+ * */ >+ if (lpn < 0) >+ return 0; >+ int ret = 0; >+ int *ok = calloc (lpn, sizeof *ok); >+ if (!ok) >+ return 0; >+ int *errnums = ped_malloc(sizeof(int) * lpn); >+ if (!errnums) >+ goto cleanup; >+ >+ /* Attempt to remove each and every partition, retrying for >+ up to max_sleep_seconds upon any failure due to EBUSY. */ >+ unsigned int sleep_microseconds = 10000; >+ unsigned int max_sleep_seconds = 1; >+ unsigned int n_sleep = (max_sleep_seconds >+ * 1000000 / sleep_microseconds); >+ int i; >+ for (i = 0; i < n_sleep; i++) { >+ if (i) >+ usleep (sleep_microseconds); >+ bool busy = false; >+ int j; >+ for (j = 0; j < lpn; j++) { >+ if (!ok[j]) { >+ ok[j] = _blkpg_remove_partition (disk, j + 1); >+ errnums[j] = errno; >+ if (!ok[j] && errnums[j] == EBUSY) >+ busy = true; >+ } >+ } >+ if (!busy) >+ break; >+ } >+ >+ for (i = 1; i <= lpn; i++) { >+ const PedPartition *part = ped_disk_get_partition (disk, i); >+ if (part) { >+ if (!ok[i - 1] && errnums[i - 1] == EBUSY) { >+ struct hd_geometry geom; >+ unsigned long long length = 0; >+ /* get start and length of existing partition */ >+ char *dev_name = _device_get_part_path (disk->dev, i); >+ if (!dev_name) >+ goto cleanup; >+ int fd = open (dev_name, O_RDONLY); >+ if (fd == -1 >+ || ioctl (fd, HDIO_GETGEO, &geom) >+ || ioctl (fd, BLKGETSIZE64, &length)) { >+ ped_exception_throw ( >+ PED_EXCEPTION_BUG, >+ PED_EXCEPTION_CANCEL, >+ _("Unable to determine the size and length of %s."), >+ dev_name); >+ if (fd != -1) >+ close (fd); >+ free (dev_name); >+ goto cleanup; >+ } >+ free (dev_name); >+ length /= disk->dev->sector_size; >+ close (fd); >+ if (geom.start == part->geom.start >+ && length == part->geom.length) >+ ok[i - 1] = 1; >+ /* If the new partition is unchanged and the >+ existing one was not removed because it was >+ in use, then reset the error flag and do not >+ try to add it since it is already there. */ >+ continue; >+ } >+ >+ /* add the (possibly modified or new) partition */ >+ if (!_blkpg_add_partition (disk, part)) { >+ ped_exception_throw ( >+ PED_EXCEPTION_ERROR, >+ PED_EXCEPTION_RETRY_CANCEL, >+ _("Failed to add partition %d (%s)"), >+ i, strerror (errno)); >+ goto cleanup; >+ } >+ } >+ } >+ >+ char *bad_part_list = NULL; >+ /* now warn about any errors */ >+ for (i = 1; i <= lpn; i++) { >+ if (ok[i - 1] || errnums[i - 1] == ENXIO) >+ continue; >+ if (bad_part_list == NULL) { >+ bad_part_list = malloc (lpn * 5); >+ if (!bad_part_list) >+ goto cleanup; >+ bad_part_list[0] = 0; >+ } >+ sprintf (bad_part_list + strlen (bad_part_list), "%d, ", i); >+ } >+ if (bad_part_list == NULL) >+ ret = 1; >+ else { >+ bad_part_list[strlen (bad_part_list) - 2] = 0; >+ if (ped_exception_throw ( >+ PED_EXCEPTION_ERROR, >+ PED_EXCEPTION_IGNORE_CANCEL, >+ _("Partition(s) %s on %s have been written, but we have " >+ "been unable to inform the kernel of the change, " >+ "probably because it/they are in use. As a result, " >+ "the old partition(s) will remain in use. You " >+ "should reboot now before making further changes."), >+ bad_part_list, disk->dev->path) == PED_EXCEPTION_IGNORE) >+ ret = 1; >+ free (bad_part_list); >+ } >+ cleanup: >+ free (errnums); >+ free (ok); >+ return ret; >+} >+ > #ifdef ENABLE_DEVICE_MAPPER > static int > _dm_remove_map_name(char *name) >@@ -2315,7 +2583,7 @@ > rc = dm_task_run(task); > dm_task_update_nodes(); > dm_task_destroy(task); >- if (rc < 0) >+ if (!rc) > return 1; > > return 0; >@@ -2335,12 +2603,8 @@ > return 0; > > dm_task_set_name(task, name); >- rc = dm_task_run(task); >- if (rc < 0) { >- rc = 0; >+ if (!dm_task_run(task)) > goto err; >- } >- rc = 0; > > memset(info, '\0', sizeof *info); > dm_task_get_info(task, info); >@@ -2351,7 +2615,6 @@ > if (!deps) > goto err; > >- rc = 0; > for (i = 0; i < deps->count; i++) { > unsigned int ma = major(deps->device[i]), > mi = minor(deps->device[i]); >@@ -2383,8 +2646,7 @@ > arch_specific->minor, 0)) > goto err; > >- rc = dm_task_run(task); >- if (rc < 0) >+ if (!dm_task_run(task)) > goto err; > > memset(info, '\0', sizeof *info); >@@ -2426,7 +2688,6 @@ > static int > _dm_add_partition (PedDisk* disk, PedPartition* part) > { >- int rc; > char* vol_name = NULL; > const char* dev_name = NULL; > char* params = NULL; >@@ -2444,8 +2705,7 @@ > arch_specific->minor, 0)) > goto err; > >- rc = dm_task_run(task); >- if (rc < 0) >+ if (!dm_task_run(task)) > goto err; > > dev_name = dm_task_get_name (task); >@@ -2468,8 +2728,7 @@ > dm_task_set_name (task, vol_name); > dm_task_add_target (task, 0, part->geom.length, > "linear", params); >- rc = dm_task_run (task); >- if (rc >= 0) { >+ if (dm_task_run (task)) { > //printf("0 %ld linear %s\n", part->geom.length, params); > dm_task_update_nodes(); > dm_task_destroy(task); >@@ -2518,52 +2777,51 @@ > #endif > > static int >-_kernel_reread_part_table (PedDevice* dev) >+_have_blkpg () > { >- LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev); >- int retry_count = 9; >- >- sync(); >- while (ioctl (arch_specific->fd, BLKRRPART)) { >- retry_count--; >- sync(); >- if (retry_count == 3) >- sleep(1); /* Pause to allow system to settle */ >+ static int have_blkpg = -1; >+ int kver; > >- if (!retry_count) { >- ped_exception_throw ( >- PED_EXCEPTION_WARNING, >- PED_EXCEPTION_IGNORE, >- _("WARNING: the kernel failed to re-read the partition " >- "table on %s (%s). As a result, it may not " >- "reflect all of your changes until after reboot."), >- dev->path, strerror (errno)); >- return 0; >- } >- } >+ if (have_blkpg != -1) >+ return have_blkpg; > >- return 1; >+ kver = _get_linux_version(); >+ return have_blkpg = kver >= KERNEL_VERSION (2,4,0) ? 1 : 0; > } > >+/* Return nonzero upon success, 0 if something fails. */ > static int > linux_disk_commit (PedDisk* disk) > { >- if (!_has_partitions (disk)) >- return 1; >+ if (!_has_partitions (disk)) >+ return 1; > > #ifdef ENABLE_DEVICE_MAPPER > if (disk->dev->type == PED_DEVICE_DM) > return _dm_reread_part_table (disk); > #endif > if (disk->dev->type != PED_DEVICE_FILE) { >- return _kernel_reread_part_table (disk->dev); >+ /* The ioctl() command BLKPG_ADD_PARTITION does not notify >+ * the devfs system; consequently, /proc/partitions will not >+ * be up to date, and the proper links in /dev are not >+ * created. Therefore, if using DevFS, we must get the kernel >+ * to re-read and grok the partition table. >+ */ >+ /* Work around kernel dasd problem so we really do BLKRRPART */ >+ int ok = 1; >+ if (disk->dev->type != PED_DEVICE_DASD && _have_blkpg ()) { >+ if (!_disk_sync_part_table (disk)) >+ ok = 0; >+ } >+ >+ return ok; > } > > return 1; > } > > #if USE_BLKID >-PedAlignment* >+static PedAlignment* > linux_get_minimum_alignment(const PedDevice *dev) > { > blkid_topology tp = LINUX_SPECIFIC(dev)->topology; >@@ -2581,7 +2839,7 @@ > blkid_topology_get_minimum_io_size(tp) / dev->sector_size); > } > >-PedAlignment* >+static PedAlignment* > linux_get_optimum_alignment(const PedDevice *dev) > { > blkid_topology tp = LINUX_SPECIFIC(dev)->topology; >diff -urN orig/libparted/device.c parted-2.2.1/libparted/device.c >--- orig/libparted/device.c 2010-02-10 17:44:40.000000000 +0100 >+++ parted-2.2.1/libparted/device.c 2010-05-19 18:20:58.000000000 +0200 >@@ -73,6 +73,16 @@ > if (walk == dev) break; > } > >+ /* This function may be called twice for the same device if a >+ libparted user explictly removes the device from the cache using >+ ped_device_cache_remove(), we get called and it then becomes the >+ user's responsibility to free the PedDevice by calling >+ ped_device_destroy(). >+ ped_device_destroy() will then call us a second time, so if the >+ device is not found in the list do nothing. */ >+ if (walk == NULL) >+ return; >+ > if (last) > last->next = dev->next; > else >@@ -139,10 +149,12 @@ > ped_device_get (const char* path) > { > PedDevice* walk; >- char* normal_path; >+ char* normal_path = NULL; > > PED_ASSERT (path != NULL, return NULL); >- normal_path = canonicalize_file_name (path); >+ /* Don't canonicalize /dev/mapper paths, see tests/symlink.c */ >+ if (strncmp (path, "/dev/mapper/", 12)) >+ normal_path = canonicalize_file_name (path); > if (!normal_path) > /* Well, maybe it is just that the file does not exist. > * Try it anyway. */ >@@ -401,7 +413,7 @@ > * constraint. > */ > PedConstraint* >-ped_device_get_constraint (PedDevice* dev) >+ped_device_get_constraint (const PedDevice* dev) > { > PedGeometry *s, *e; > PedConstraint* c = ped_constraint_new ( >diff -urN orig/libparted/disk.c parted-2.2.1/libparted/disk.c >--- orig/libparted/disk.c 2010-02-23 17:26:20.000000000 +0100 >+++ parted-2.2.1/libparted/disk.c 2010-05-19 17:28:44.000000000 +0200 >@@ -2442,6 +2442,8 @@ > return N_("msftres"); > case PED_PARTITION_APPLE_TV_RECOVERY: > return N_("atvrecv"); >+ case PED_PARTITION_DIAG: >+ return N_("diag"); > > default: > ped_exception_throw ( >diff -urN orig/libparted/fs/ext2/ext2_fs.h parted-2.2.1/libparted/fs/ext2/ext2_fs.h >--- orig/libparted/fs/ext2/ext2_fs.h 2010-02-08 07:48:18.000000000 +0100 >+++ parted-2.2.1/libparted/fs/ext2/ext2_fs.h 2010-05-19 17:05:42.000000000 +0200 >@@ -57,12 +57,14 @@ > #define EXT2_FEATURE_RO_COMPAT_SPARSE_SUPER 0x0001 > #define EXT2_FEATURE_RO_COMPAT_LARGE_FILE 0x0002 > #define EXT4_FEATURE_RO_COMPAT_HUGE_FILE 0x0008 >+#define EXT4_FEATURE_RO_COMPAT_GDT_CSUM 0x0010 > #define EXT4_FEATURE_RO_COMPAT_DIR_NLINK 0x0020 > > #define EXT2_FEATURE_INCOMPAT_FILETYPE 0x0002 > #define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 > #define EXT4_FEATURE_INCOMPAT_EXTENTS 0x0040 > #define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 >+#define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 > > /* > * Special inodes numbers >diff -urN orig/libparted/fs/ext2/interface.c parted-2.2.1/libparted/fs/ext2/interface.c >--- orig/libparted/fs/ext2/interface.c 2010-02-08 07:48:18.000000000 +0100 >+++ parted-2.2.1/libparted/fs/ext2/interface.c 2010-05-19 17:05:42.000000000 +0200 >@@ -55,11 +55,15 @@ > is_ext4 = ((EXT2_SUPER_FEATURE_RO_COMPAT (*sb) > & EXT4_FEATURE_RO_COMPAT_HUGE_FILE) > || (EXT2_SUPER_FEATURE_RO_COMPAT (*sb) >+ & EXT4_FEATURE_RO_COMPAT_GDT_CSUM) >+ || (EXT2_SUPER_FEATURE_RO_COMPAT (*sb) > & EXT4_FEATURE_RO_COMPAT_DIR_NLINK) > || (EXT2_SUPER_FEATURE_INCOMPAT (*sb) > & EXT4_FEATURE_INCOMPAT_EXTENTS) > || (EXT2_SUPER_FEATURE_INCOMPAT (*sb) >- & EXT4_FEATURE_INCOMPAT_64BIT)); >+ & EXT4_FEATURE_INCOMPAT_64BIT) >+ || (EXT2_SUPER_FEATURE_INCOMPAT (*sb) >+ & EXT4_FEATURE_INCOMPAT_FLEX_BG)); > if (is_ext4) > is_ext3 = 0; > } >diff -urN orig/libparted/fs/ext2/parted_io.c parted-2.2.1/libparted/fs/ext2/parted_io.c >--- orig/libparted/fs/ext2/parted_io.c 2010-02-08 07:48:18.000000000 +0100 >+++ parted-2.2.1/libparted/fs/ext2/parted_io.c 2010-05-19 17:22:32.000000000 +0200 >@@ -82,7 +82,9 @@ > { > struct my_cookie *monster = cookie; > >- return ped_geometry_read(monster->geom, ptr, block << (monster->logsize - 9), num << (monster->logsize - 9)); >+ return ped_geometry_read(monster->geom, ptr, >+ (PedSector) block << (monster->logsize - 9), >+ (PedSector) num << (monster->logsize - 9)); > } > > static int do_set_blocksize(void *cookie, int logsize) >@@ -98,8 +100,8 @@ > struct my_cookie *monster = cookie; > > return ped_geometry_write(monster->geom, ptr, >- block << (monster->logsize - 9), >- num << (monster->logsize - 9)); >+ (PedSector) block << (monster->logsize - 9), >+ (PedSector) num << (monster->logsize - 9)); > } > > >diff -urN orig/libparted/labels/dos.c parted-2.2.1/libparted/labels/dos.c >--- orig/libparted/labels/dos.c 2010-02-26 15:15:02.000000000 +0100 >+++ parted-2.2.1/libparted/labels/dos.c 2010-05-19 18:20:12.000000000 +0200 >@@ -81,6 +81,7 @@ > #define PARTITION_FAT16_LBA_H (PARTITION_FAT16_LBA | PART_FLAG_HIDDEN) > > #define PARTITION_COMPAQ_DIAG 0x12 >+#define PARTITION_MSFT_RECOVERY 0x27 > #define PARTITION_LDM 0x42 > #define PARTITION_LINUX_SWAP 0x82 > #define PARTITION_LINUX 0x83 >@@ -157,6 +158,7 @@ > int lba; > int palo; > int prep; >+ int diag; > OrigState* orig; /* used for CHS stuff */ > } DosPartitionData; > >@@ -828,6 +830,9 @@ > dos_data = part->disk_specific; > dos_data->system = raw_part->type; > dos_data->boot = raw_part->boot_ind != 0; >+ dos_data->diag = raw_part->type == PARTITION_COMPAQ_DIAG || >+ raw_part->type == PARTITION_MSFT_RECOVERY || >+ raw_part->type == PARTITION_DELL_DIAG; > dos_data->hidden = raw_part_is_hidden (raw_part); > dos_data->raid = raw_part->type == PARTITION_LINUX_RAID; > dos_data->lvm = raw_part->type == PARTITION_LINUX_LVM_OLD >@@ -1231,6 +1236,7 @@ > dos_data->system = PARTITION_LINUX; > dos_data->hidden = 0; > dos_data->boot = 0; >+ dos_data->diag = 0; > dos_data->raid = 0; > dos_data->lvm = 0; > dos_data->lba = 0; >@@ -1264,6 +1270,7 @@ > new_dos_data = (DosPartitionData*) new_part->disk_specific; > new_dos_data->system = old_dos_data->system; > new_dos_data->boot = old_dos_data->boot; >+ new_dos_data->diag = old_dos_data->diag; > new_dos_data->hidden = old_dos_data->hidden; > new_dos_data->raid = old_dos_data->raid; > new_dos_data->lvm = old_dos_data->lvm; >@@ -1313,6 +1320,7 @@ > dos_data->hidden = 0; > > if (part->type & PED_PARTITION_EXTENDED) { >+ dos_data->diag = 0; > dos_data->raid = 0; > dos_data->lvm = 0; > dos_data->palo = 0; >@@ -1324,6 +1332,15 @@ > return 1; > } > >+ if (dos_data->diag) { >+ /* Don't change the system if it already is a diag type, >+ otherwise use Compaq as almost all vendors use that. */ >+ if (dos_data->system != PARTITION_COMPAQ_DIAG && >+ dos_data->system != PARTITION_MSFT_RECOVERY && >+ dos_data->system != PARTITION_DELL_DIAG) >+ dos_data->system = PARTITION_COMPAQ_DIAG; >+ return 1; >+ } > if (dos_data->lvm) { > dos_data->system = PARTITION_LINUX_LVM; > return 1; >@@ -1368,6 +1385,17 @@ > return 1; > } > >+static void >+clear_flags (DosPartitionData *dos_data) >+{ >+ dos_data->diag = 0; >+ dos_data->hidden = 0; >+ dos_data->lvm = 0; >+ dos_data->palo = 0; >+ dos_data->prep = 0; >+ dos_data->raid = 0; >+} >+ > static int > msdos_partition_set_flag (PedPartition* part, > PedPartitionFlag flag, int state) >@@ -1409,23 +1437,21 @@ > } > return 1; > >+ case PED_PARTITION_DIAG: >+ if (state) >+ clear_flags (dos_data); >+ dos_data->diag = state; >+ return ped_partition_set_system (part, part->fs_type); >+ > case PED_PARTITION_RAID: >- if (state) { >- dos_data->hidden = 0; >- dos_data->lvm = 0; >- dos_data->palo = 0; >- dos_data->prep = 0; >- } >+ if (state) >+ clear_flags (dos_data); > dos_data->raid = state; > return ped_partition_set_system (part, part->fs_type); > > case PED_PARTITION_LVM: >- if (state) { >- dos_data->hidden = 0; >- dos_data->raid = 0; >- dos_data->palo = 0; >- dos_data->prep = 0; >- } >+ if (state) >+ clear_flags (dos_data); > dos_data->lvm = state; > return ped_partition_set_system (part, part->fs_type); > >@@ -1434,20 +1460,14 @@ > return ped_partition_set_system (part, part->fs_type); > > case PED_PARTITION_PALO: >- if (state) { >- dos_data->hidden = 0; >- dos_data->raid = 0; >- dos_data->lvm = 0; >- } >+ if (state) >+ clear_flags (dos_data); > dos_data->palo = state; > return ped_partition_set_system (part, part->fs_type); > > case PED_PARTITION_PREP: >- if (state) { >- dos_data->hidden = 0; >- dos_data->raid = 0; >- dos_data->lvm = 0; >- } >+ if (state) >+ clear_flags (dos_data); > dos_data->prep = state; > return ped_partition_set_system (part, part->fs_type); > >@@ -1467,11 +1487,17 @@ > dos_data = part->disk_specific; > switch (flag) { > case PED_PARTITION_HIDDEN: >- return dos_data->hidden; >+ if (part->type == PED_PARTITION_EXTENDED) >+ return 0; >+ else >+ return dos_data->hidden; > > case PED_PARTITION_BOOT: > return dos_data->boot; > >+ case PED_PARTITION_DIAG: >+ return dos_data->diag; >+ > case PED_PARTITION_RAID: > return dos_data->raid; > >@@ -1498,12 +1524,18 @@ > { > switch (flag) { > case PED_PARTITION_HIDDEN: >+ if (part->type == PED_PARTITION_EXTENDED) >+ return 0; >+ else >+ return 1; >+ > case PED_PARTITION_BOOT: > case PED_PARTITION_RAID: > case PED_PARTITION_LVM: > case PED_PARTITION_LBA: > case PED_PARTITION_PALO: > case PED_PARTITION_PREP: >+ case PED_PARTITION_DIAG: > return 1; > > default: >@@ -1606,8 +1638,13 @@ > dev->length - min_geom->end)) > return NULL; > } else { >- if (!ped_geometry_init (&start_geom, dev, cylinder_size, >- dev->length - cylinder_size)) >+ /* Do not assume that length is larger than 1 cylinder's >+ worth of sectors. This is useful when testing with >+ a memory-mapped "disk" (a la scsi_debug) that is say, >+ 2048 sectors long. */ >+ if (cylinder_size < dev->length >+ && !ped_geometry_init (&start_geom, dev, cylinder_size, >+ dev->length - cylinder_size)) > return NULL; > if (!ped_geometry_init (&end_geom, dev, 0, dev->length)) > return NULL; >@@ -1739,7 +1776,11 @@ > min_geom = ped_geometry_duplicate (&walk->geom); > if (!min_geom) > return NULL; >- ped_geometry_set_start (min_geom, walk->geom.start - 1 * head_size); >+ /* We must always allow at least two sectors at the start, to leave >+ * room for LILO. See linux/fs/partitions/msdos.c. >+ */ >+ ped_geometry_set_start (min_geom, >+ walk->geom.start - PED_MAX (1 * head_size, 2)); > > for (walk = ext_part->part_list; walk; walk = walk->next) { > if (!ped_partition_is_active (walk) || walk->num == 5) >diff -urN orig/libparted/labels/gpt.c parted-2.2.1/libparted/labels/gpt.c >--- orig/libparted/labels/gpt.c 2010-02-22 14:11:16.000000000 +0100 >+++ parted-2.2.1/libparted/labels/gpt.c 2010-05-19 17:30:09.000000000 +0200 >@@ -103,6 +103,10 @@ > ((efi_guid_t) { PED_CPU_TO_LE32 (0xE3C9E316), PED_CPU_TO_LE16 (0x0B5C), \ > PED_CPU_TO_LE16 (0x4DB8), 0x81, 0x7D, \ > { 0xF9, 0x2D, 0xF0, 0x02, 0x15, 0xAE }}) >+#define PARTITION_MSFT_RECOVERY \ >+ ((efi_guid_t) { PED_CPU_TO_LE32 (0xDE94BBA4), PED_CPU_TO_LE16 (0x06D1), \ >+ PED_CPU_TO_LE16 (0x4D40), 0xA1, 0x6A, \ >+ { 0xBF, 0xD5, 0x01, 0x79, 0xD6, 0xAC }}) > #define PARTITION_BASIC_DATA_GUID \ > ((efi_guid_t) { PED_CPU_TO_LE32 (0xEBD0A0A2), PED_CPU_TO_LE16 (0xB9E5), \ > PED_CPU_TO_LE16 (0x4433), 0x87, 0xC0, \ >@@ -269,6 +273,7 @@ > int hidden; > int msftres; > int atvrecv; >+ int msftrecv; > } GPTPartitionData; > > static PedDiskType gpt_disk_type; >@@ -773,6 +778,7 @@ > gpt_part_data->lvm = gpt_part_data->raid > = gpt_part_data->boot = gpt_part_data->hp_service > = gpt_part_data->hidden = gpt_part_data->msftres >+ = gpt_part_data->msftrecv > = gpt_part_data->bios_grub = gpt_part_data->atvrecv = 0; > > if (pte->Attributes.RequiredToFunction & 0x1) >@@ -790,6 +796,8 @@ > gpt_part_data->hp_service = 1; > else if (!guid_cmp (gpt_part_data->type, PARTITION_MSFT_RESERVED_GUID)) > gpt_part_data->msftres = 1; >+ else if (!guid_cmp (gpt_part_data->type, PARTITION_MSFT_RECOVERY)) >+ gpt_part_data->msftrecv = 1; > else if (!guid_cmp (gpt_part_data->type, PARTITION_APPLE_TV_RECOVERY_GUID)) > gpt_part_data->atvrecv = 1; > >@@ -1291,6 +1299,7 @@ > gpt_part_data->hp_service = 0; > gpt_part_data->hidden = 0; > gpt_part_data->msftres = 0; >+ gpt_part_data->msftrecv = 0; > gpt_part_data->atvrecv = 0; > uuid_generate ((unsigned char *) &gpt_part_data->uuid); > swap_uuid_and_efi_guid ((unsigned char *) (&gpt_part_data->uuid)); >@@ -1387,6 +1396,11 @@ > gpt_part_data->type = PARTITION_MSFT_RESERVED_GUID; > return 1; > } >+ if (gpt_part_data->msftrecv) >+ { >+ gpt_part_data->type = PARTITION_MSFT_RECOVERY; >+ return 1; >+ } > if (gpt_part_data->atvrecv) > { > gpt_part_data->type = PARTITION_APPLE_TV_RECOVERY_GUID; >@@ -1491,6 +1505,7 @@ > = gpt_part_data->bios_grub > = gpt_part_data->hp_service > = gpt_part_data->msftres >+ = gpt_part_data->msftrecv > = gpt_part_data->atvrecv = 0; > return gpt_partition_set_system (part, part->fs_type); > case PED_PARTITION_BIOS_GRUB: >@@ -1501,6 +1516,7 @@ > = gpt_part_data->boot > = gpt_part_data->hp_service > = gpt_part_data->msftres >+ = gpt_part_data->msftrecv > = gpt_part_data->atvrecv = 0; > return gpt_partition_set_system (part, part->fs_type); > case PED_PARTITION_RAID: >@@ -1511,6 +1527,7 @@ > = gpt_part_data->bios_grub > = gpt_part_data->hp_service > = gpt_part_data->msftres >+ = gpt_part_data->msftrecv > = gpt_part_data->atvrecv = 0; > return gpt_partition_set_system (part, part->fs_type); > case PED_PARTITION_LVM: >@@ -1521,6 +1538,7 @@ > = gpt_part_data->bios_grub > = gpt_part_data->hp_service > = gpt_part_data->msftres >+ = gpt_part_data->msftrecv > = gpt_part_data->atvrecv = 0; > return gpt_partition_set_system (part, part->fs_type); > case PED_PARTITION_HPSERVICE: >@@ -1531,6 +1549,7 @@ > = gpt_part_data->lvm > = gpt_part_data->bios_grub > = gpt_part_data->msftres >+ = gpt_part_data->msftrecv > = gpt_part_data->atvrecv = 0; > return gpt_partition_set_system (part, part->fs_type); > case PED_PARTITION_MSFT_RESERVED: >@@ -1541,6 +1560,18 @@ > = gpt_part_data->lvm > = gpt_part_data->bios_grub > = gpt_part_data->hp_service >+ = gpt_part_data->msftrecv >+ = gpt_part_data->atvrecv = 0; >+ return gpt_partition_set_system (part, part->fs_type); >+ case PED_PARTITION_DIAG: >+ gpt_part_data->msftrecv = state; >+ if (state) >+ gpt_part_data->boot >+ = gpt_part_data->raid >+ = gpt_part_data->lvm >+ = gpt_part_data->bios_grub >+ = gpt_part_data->hp_service >+ = gpt_part_data->msftres > = gpt_part_data->atvrecv = 0; > return gpt_partition_set_system (part, part->fs_type); > case PED_PARTITION_APPLE_TV_RECOVERY: >@@ -1551,7 +1582,8 @@ > = gpt_part_data->lvm > = gpt_part_data->bios_grub > = gpt_part_data->hp_service >- = gpt_part_data->msftres = 0; >+ = gpt_part_data->msftres >+ = gpt_part_data->msftrecv = 0; > return gpt_partition_set_system (part, part->fs_type); > case PED_PARTITION_HIDDEN: > gpt_part_data->hidden = state; >@@ -1586,7 +1618,9 @@ > return gpt_part_data->hp_service; > case PED_PARTITION_MSFT_RESERVED: > return gpt_part_data->msftres; >- case PED_PARTITION_APPLE_TV_RECOVERY: >+ case PED_PARTITION_DIAG: >+ return gpt_part_data->msftrecv; >+ case PED_PARTITION_APPLE_TV_RECOVERY: > return gpt_part_data->atvrecv; > case PED_PARTITION_HIDDEN: > return gpt_part_data->hidden; >@@ -1611,6 +1645,7 @@ > case PED_PARTITION_BIOS_GRUB: > case PED_PARTITION_HPSERVICE: > case PED_PARTITION_MSFT_RESERVED: >+ case PED_PARTITION_DIAG: > case PED_PARTITION_APPLE_TV_RECOVERY: > case PED_PARTITION_HIDDEN: > return 1; >diff -urN orig/libparted/labels/pt-tools.c parted-2.2.1/libparted/labels/pt-tools.c >--- orig/libparted/labels/pt-tools.c 2010-02-08 07:48:18.000000000 +0100 >+++ parted-2.2.1/libparted/labels/pt-tools.c 2010-05-19 17:04:21.000000000 +0200 >@@ -127,7 +127,7 @@ > " of %jd"), > part->geom.length, > pt_type, >- UINT32_MAX); >+ pt_lim->max_length); > return 0; > } > >@@ -140,7 +140,7 @@ > " of %jd"), > part->geom.start, > pt_type, >- UINT32_MAX); >+ pt_lim->max_start_sector); > return 0; > } > >diff -urN orig/parted/parted.c parted-2.2.1/parted/parted.c >--- orig/parted/parted.c 2010-02-10 17:44:40.000000000 +0100 >+++ parted-2.2.1/parted/parted.c 2010-05-19 17:09:15.000000000 +0200 >@@ -1396,7 +1396,8 @@ > const char *const transport[] = {"unknown", "scsi", "ide", "dac960", > "cpqarray", "file", "ataraid", "i2o", > "ubd", "dasd", "viodasd", "sx8", "dm", >- "xvd", "sd/mmc", "virtblk"}; >+ "xvd", "sd/mmc", "virtblk", "aoe", >+ "md"}; > char* peek_word; > char* start; > char* end; >diff -urN orig/parted/ui.c parted-2.2.1/parted/ui.c >--- orig/parted/ui.c 2010-02-08 07:48:18.000000000 +0100 >+++ parted-2.2.1/parted/ui.c 2010-05-19 18:22:08.000000000 +0200 >@@ -1517,6 +1517,7 @@ > fputs (_("COMMANDs:"), stdout); > putchar ('\n'); > print_commands_help (); >+ printf (_("\nReport bugs to %s\n"), PACKAGE_BUGREPORT); > exit (EXIT_SUCCESS); > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 320563
:
232099
|
232117
| 232119