[parted-devel] [PATCH 2/3] Remove has_partitions check to allow loopback partitions

Petr Uzel petr.uzel at suse.cz
Fri Dec 2 08:53:45 UTC 2011


On Thu, Dec 01, 2011 at 04:38:33PM -0500, Phillip Susi wrote:
> Commit 1b766b69 added the _has_partitions function to check if a device
> was a loop device and if so, skip updating the kernel partition table
> because loop devices did not support partitions.  This function never
> worked anyway, 

Could you be more specific about when does it not work?

> and loop devices now ( since linux 3.0 ) support partitions,
> so remove this crufty code.

Doesn't it break parted+loop devices with older than 3.0 kernel?

> 
> Signed-off-by: Phillip Susi <psusi at cfl.rr.com>
> ---
>  libparted/arch/linux.c |   24 ------------------------
>  1 files changed, 0 insertions(+), 24 deletions(-)
> 
> diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
> index aab2dd8..3799b9d 100644
> --- a/libparted/arch/linux.c
> +++ b/libparted/arch/linux.c
> @@ -2315,18 +2315,6 @@ _partition_is_mounted (const PedPartition *part)
>  }
>  
>  static int
> -_has_partitions (const PedDisk* disk)
> -{
> -        PED_ASSERT(disk != NULL);
> -
> -        /* Some devices can't be partitioned. */
> -        if (!strcmp (disk->type->name, "loop"))
> -                return 0;
> -
> -        return 1;
> -}
> -
> -static int
>  linux_partition_is_busy (const PedPartition* part)
>  {
>          PedPartition*   walk;
> @@ -2368,9 +2356,6 @@ _blkpg_add_partition (PedDisk* disk, const PedPartition *part)
>          PED_ASSERT(disk != NULL);
>          PED_ASSERT(disk->dev->sector_size % PED_SECTOR_SIZE_DEFAULT == 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);
> @@ -2419,9 +2404,6 @@ _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,
> @@ -2743,9 +2725,6 @@ _dm_add_partition (PedDisk* disk, PedPartition* part)
>          char*           params = NULL;
>          LinuxSpecific*  arch_specific = LINUX_SPECIFIC (disk->dev);
>  
> -        if (!_has_partitions(disk))
> -                return 0;
> -
>          /* Get map name from devicemapper */
>          struct dm_task *task = dm_task_create (DM_DEVICE_INFO);
>          if (!task)
> @@ -2843,9 +2822,6 @@ _have_blkpg ()
>  static int
>  linux_disk_commit (PedDisk* disk)
>  {
> -        if (!_has_partitions (disk))
> -                return 1;
> -
>  #ifdef ENABLE_DEVICE_MAPPER
>          if (disk->dev->type == PED_DEVICE_DM)
>                  return _dm_reread_part_table (disk);
> -- 
> 1.7.5.4
> 
> 

Petr

--
Petr Uzel
IRC: ptr_uzl @ freenode



More information about the parted-devel mailing list