[parted-devel] Use PED_SECTOR_SIZE_DEFAULT not 512

Jim Meyering jim at meyering.net
Thu Mar 8 23:16:41 CET 2007


This is purely syntactic, so committed already.

Use PED_SECTOR_SIZE_DEFAULT not 512

* libparted/arch/beos.c (beos_read, beos_write):
	* libparted/arch/linux.c (_device_get_length, _device_seek)
	(linux_read, linux_write, _blkpg_add_partition):
	* libparted/fs/fat/bootsector.c (fat_boot_sector_read):
	* libparted/labels/bsd.c (bsd_alloc):
	* libparted/labels/dos.c (probe_filesystem_for_geom):
	* libparted/labels/rdb.c (amiga_read):
---

 libparted/arch/beos.c         |    6 +++---
 libparted/arch/linux.c        |   11 ++++++-----
 libparted/fs/fat/bootsector.c |    3 ++-
 libparted/labels/bsd.c        |    2 +-
 libparted/labels/dos.c        |    3 ++-
 libparted/labels/rdb.c        |    3 ++-
 6 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/libparted/arch/beos.c b/libparted/arch/beos.c
index 436ad45..6b6c897 100644
--- a/libparted/arch/beos.c
+++ b/libparted/arch/beos.c
@@ -1,6 +1,6 @@
 /*
     libparted - a library for manipulating disk partitions
-    Copyright (C) 2006 Free Software Foundation, Inc.
+    Copyright (C) 2006, 2007 Free Software Foundation, Inc.
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -396,7 +396,7 @@ beos_read (const PedDevice* dev, void* buffer, PedSector start, PedSector count)
 	PedExceptionOption ex_status;
 	size_t read_length = count * dev->sector_size;
 
-	PED_ASSERT(dev->sector_size % 512 == 0, return 0);
+	PED_ASSERT(dev->sector_size % PED_SECTOR_SIZE_DEFAULT == 0, return 0);
 
 	/* First, try to seek */
 	while(1)
@@ -470,7 +470,7 @@ beos_write (PedDevice* dev, const void* buffer, PedSector start,
 	PedExceptionOption      ex_status;
 	size_t                  write_length = count * dev->sector_size;
 
-	PED_ASSERT(dev->sector_size % 512 == 0, return 0);
+	PED_ASSERT(dev->sector_size % PED_SECTOR_SIZE_DEFAULT == 0, return 0);
 
 	if (dev->read_only)
 	{
diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 824b6e0..312cc8c 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -568,7 +568,7 @@ _device_get_length (PedDevice* dev)
 
 
         PED_ASSERT (dev->open_count > 0, return 0);
-        PED_ASSERT (dev->sector_size % 512 == 0, return 0);
+        PED_ASSERT (dev->sector_size % PED_SECTOR_SIZE_DEFAULT == 0, return 0);
 
         if (_kernel_has_blkgetsize64()) {
                 if (ioctl(arch_specific->fd, BLKGETSIZE64, &bytes) == 0) {
@@ -1351,7 +1351,7 @@ _device_seek (const PedDevice* dev, PedSector sector)
 {
         LinuxSpecific*  arch_specific;
         
-        PED_ASSERT (dev->sector_size % 512 == 0, return 0);
+        PED_ASSERT (dev->sector_size % PED_SECTOR_SIZE_DEFAULT == 0, return 0);
         PED_ASSERT (dev != NULL, return 0);
         PED_ASSERT (!dev->external_mode, return 0);
         
@@ -1411,7 +1411,7 @@ linux_read (const PedDevice* dev, void* buffer, PedSector start,
         PedExceptionOption      ex_status;
         void*                   diobuf;
 
-        PED_ASSERT (dev->sector_size % 512 == 0, return 0);
+        PED_ASSERT (dev->sector_size % PED_SECTOR_SIZE_DEFAULT == 0, return 0);
 
         if (_get_linux_version() < KERNEL_VERSION (2,6,0)) {
                 /* Kludge.  This is necessary to read/write the last
@@ -1539,7 +1539,7 @@ linux_write (PedDevice* dev, const void* buffer, PedSector start,
         void*                   diobuf;
         void*                   diobuf_start;
 
-        PED_ASSERT(dev->sector_size % 512 == 0, return 0);
+        PED_ASSERT(dev->sector_size % PED_SECTOR_SIZE_DEFAULT == 0, return 0);
 
         if (dev->read_only) {
                 if (ped_exception_throw (
@@ -2047,7 +2047,8 @@ _blkpg_add_partition (PedDisk* disk, PedPartition* part)
         char*                   dev_name;
 
         PED_ASSERT(disk != NULL, return 0);
-        PED_ASSERT(disk->dev->sector_size % 512 == 0, return 0);
+        PED_ASSERT(disk->dev->sector_size % PED_SECTOR_SIZE_DEFAULT == 0,
+                   return 0);
 
         if (ped_disk_type_check_feature (disk->type,
                                          PED_DISK_TYPE_PARTITION_NAME))
diff --git a/libparted/fs/fat/bootsector.c b/libparted/fs/fat/bootsector.c
index c8826c8..23b34dc 100644
--- a/libparted/fs/fat/bootsector.c
+++ b/libparted/fs/fat/bootsector.c
@@ -58,7 +58,8 @@ fat_boot_sector_read (FatBootSector* bs, const PedGeometry *geom)
 		return 0;
 	}
 
-	if (!bs->sector_size || PED_LE16_TO_CPU (bs->sector_size) % 512) {
+	if (!bs->sector_size
+            || PED_LE16_TO_CPU (bs->sector_size) % PED_SECTOR_SIZE_DEFAULT) {
 		ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
 			_("File system has an invalid sector size for a FAT "
 			  "file system."));
diff --git a/libparted/labels/bsd.c b/libparted/labels/bsd.c
index 99822b2..747a9c5 100644
--- a/libparted/labels/bsd.c
+++ b/libparted/labels/bsd.c
@@ -174,7 +174,7 @@ bsd_alloc (const PedDevice* dev)
 	BSDDiskData*	bsd_specific;
 	BSDRawLabel*	label;
 
-	PED_ASSERT(dev->sector_size % 512 == 0, return 0);
+	PED_ASSERT(dev->sector_size % PED_SECTOR_SIZE_DEFAULT == 0, return 0);
 
 	disk = _ped_disk_alloc ((PedDevice*)dev, &bsd_disk_type);
 	if (!disk)
diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index 6547dd1..8e7707e 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -426,7 +426,8 @@ probe_filesystem_for_geom (const PedPartition* part, PedCHSGeometry* bios_geom)
         PED_ASSERT (part             != NULL, return 0);
         PED_ASSERT (part->disk       != NULL, return 0);
         PED_ASSERT (part->disk->dev  != NULL, return 0);
-	PED_ASSERT (part->disk->dev->sector_size % 512 == 0, return 0);
+        PED_ASSERT (part->disk->dev->sector_size % PED_SECTOR_SIZE_DEFAULT == 0,
+                    return 0);
 
         buf = ped_malloc (part->disk->dev->sector_size);
         
diff --git a/libparted/labels/rdb.c b/libparted/labels/rdb.c
index b98fb35..35ed156 100644
--- a/libparted/labels/rdb.c
+++ b/libparted/labels/rdb.c
@@ -487,7 +487,8 @@ amiga_read (PedDisk* disk)
 
 	PED_ASSERT(disk != NULL, return 0);
 	PED_ASSERT(disk->dev != NULL, return 0);
-	PED_ASSERT(disk->dev->sector_size % 512 == 0, return 0);
+	PED_ASSERT(disk->dev->sector_size % PED_SECTOR_SIZE_DEFAULT == 0,
+                   return 0);
 	PED_ASSERT(disk->disk_specific != NULL, return 0);
 	rdb = RDSK(disk->disk_specific);
 



More information about the parted-devel mailing list