[parted-devel] [PATCH 26/28] fs/r/hfs: Remove disabled code

Brian C. Lane bcl at redhat.com
Fri Nov 20 22:22:41 GMT 2020


---
 libparted/fs/r/hfs/hfs.c | 194 ---------------------------------------
 1 file changed, 194 deletions(-)

diff --git a/libparted/fs/r/hfs/hfs.c b/libparted/fs/r/hfs/hfs.c
index 09899da..1da093c 100644
--- a/libparted/fs/r/hfs/hfs.c
+++ b/libparted/fs/r/hfs/hfs.c
@@ -59,28 +59,6 @@ static PedFileSystemType hfsplus_type;
 
 /* ----- HFS ----- */
 
-#if 0
-/* This is a very unundoable operation */
-/* Maybe I shouldn't touch the alternate MDB ? */
-/* Anyway clobber is call before other fs creation */
-/* So this is a non-issue */
-static int
-hfs_clobber (PedGeometry* geom)
-{
-	uint8_t	buf[PED_SECTOR_SIZE_DEFAULT];
-
-	memset (buf, 0, PED_SECTOR_SIZE_DEFAULT);
-
-	/* destroy boot blocks, mdb, alternate mdb ... */
-	return	(!!ped_geometry_write (geom, buf, 0, 1)) &
-		(!!ped_geometry_write (geom, buf, 1, 1)) &
-		(!!ped_geometry_write (geom, buf, 2, 1)) &
-		(!!ped_geometry_write (geom, buf, geom->length - 2, 1)) &
-		(!!ped_geometry_write (geom, buf, geom->length - 1, 1)) &
-		(!!ped_geometry_sync  (geom));
-}
-#endif
-
 PedFileSystem *
 hfs_open (PedGeometry* geom)
 {
@@ -341,44 +319,6 @@ hfs_resize (PedFileSystem* fs, PedGeometry* geom, PedTimer* timer)
 #include "reloc_plus.h"
 #include "journal.h"
 
-#if 0
-static int
-hfsplus_clobber (PedGeometry* geom)
-{
-	unsigned int i = 1;
-	uint8_t				buf[PED_SECTOR_SIZE_DEFAULT];
-	HfsMasterDirectoryBlock		*mdb;
-
-	mdb = (HfsMasterDirectoryBlock *) buf;
-
-	if (!ped_geometry_read (geom, buf, 2, 1))
-		return 0;
-
-	if (PED_BE16_TO_CPU (mdb->signature) == HFS_SIGNATURE) {
-		/* embedded hfs+ */
-		PedGeometry	*embedded;
-
-		i = PED_BE32_TO_CPU(mdb->block_size) / PED_SECTOR_SIZE_DEFAULT;
-		embedded = ped_geometry_new (
-		    geom->dev,
-		    (PedSector) geom->start
-		     + PED_BE16_TO_CPU (mdb->start_block)
-		     + (PedSector) PED_BE16_TO_CPU (
-			mdb->old_new.embedded.location.start_block ) * i,
-		    (PedSector) PED_BE16_TO_CPU (
-			mdb->old_new.embedded.location.block_count ) * i );
-		if (!embedded) i = 0;
-		else {
-			i = hfs_clobber (embedded);
-			ped_geometry_destroy (embedded);
-		}
-	}
-
-	/* non-embedded or envelop destroy as hfs */
-	return ( hfs_clobber (geom) && i );
-}
-#endif
-
 int
 hfsplus_close (PedFileSystem *fs)
 {
@@ -1224,137 +1164,3 @@ hfsplus_extract (PedFileSystem* fs, PedTimer* timer)
 #endif /* HFS_EXTRACT_FS */
 
 #endif /* !DISCOVER_ONLY */
-
-#if 0
-static PedFileSystemOps hfs_ops = {
-	probe:		hfs_probe,
-#ifndef DISCOVER_ONLY
-	clobber:	hfs_clobber,
-	open:		hfs_open,
-	create:		NULL,
-	close:		hfs_close,
-#ifndef HFS_EXTRACT_FS
-	check:		NULL,
-#else
-	check:		hfs_extract,
-#endif
-	copy:		NULL,
-	resize:		hfs_resize,
-	get_create_constraint:	NULL,
-	get_resize_constraint:	hfs_get_resize_constraint,
-	get_copy_constraint:	NULL,
-#else /* DISCOVER_ONLY */
-	clobber:	NULL,
-	open:		NULL,
-	create:		NULL,
-	close:		NULL,
-	check:		NULL,
-	copy:		NULL,
-	resize:		NULL,
-	get_create_constraint:	NULL,
-	get_resize_constraint:	NULL,
-	get_copy_constraint:	NULL,
-#endif /* DISCOVER_ONLY */
-};
-
-static PedFileSystemOps hfsplus_ops = {
-	probe:		hfsplus_probe,
-#ifndef DISCOVER_ONLY
-	clobber:	hfsplus_clobber,
-	open:		hfsplus_open,
-	create:		NULL,
-	close:		hfsplus_close,
-#ifndef HFS_EXTRACT_FS
-	check:		NULL,
-#else
-	check:		hfsplus_extract,
-#endif
-	copy:		NULL,
-	resize:		hfsplus_resize,
-	get_create_constraint:	NULL,
-	get_resize_constraint:	hfsplus_get_resize_constraint,
-	get_copy_constraint:	NULL,
-#else /* DISCOVER_ONLY */
-	clobber:	NULL,
-	open:		NULL,
-	create:		NULL,
-	close:		NULL,
-	check:		NULL,
-	copy:		NULL,
-	resize:		NULL,
-	get_create_constraint:	NULL,
-	get_resize_constraint:	NULL,
-	get_copy_constraint:	NULL,
-#endif /* DISCOVER_ONLY */
-};
-
-static PedFileSystemOps hfsx_ops = {
-	probe:		hfsx_probe,
-#ifndef DISCOVER_ONLY
-	clobber:	hfs_clobber, /* NOT hfsplus_clobber !
-					HFSX can't be embedded */
-	open:		hfsplus_open,
-	create:		NULL,
-	close:		hfsplus_close,
-#ifndef HFS_EXTRACT_FS
-	check:		NULL,
-#else
-	check:		hfsplus_extract,
-#endif
-	copy:		NULL,
-	resize:		hfsplus_resize,
-	get_create_constraint:	NULL,
-	get_resize_constraint:	hfsplus_get_resize_constraint,
-	get_copy_constraint:	NULL,
-#else /* DISCOVER_ONLY */
-	clobber:	NULL,
-	open:		NULL,
-	create:		NULL,
-	close:		NULL,
-	check:		NULL,
-	copy:		NULL,
-	resize:		NULL,
-	get_create_constraint:	NULL,
-	get_resize_constraint:	NULL,
-	get_copy_constraint:	NULL,
-#endif /* DISCOVER_ONLY */
-};
-
-
-static PedFileSystemType hfs_type = {
-	next:	NULL,
-	ops:	&hfs_ops,
-	name:	"hfs",
-	block_sizes: HFS_BLOCK_SIZES
-};
-
-static PedFileSystemType hfsplus_type = {
-	next:	NULL,
-	ops:	&hfsplus_ops,
-	name:	"hfs+",
-	block_sizes: HFSP_BLOCK_SIZES
-};
-
-static PedFileSystemType hfsx_type = {
-	next:	NULL,
-	ops:	&hfsx_ops,
-	name:	"hfsx",
-	block_sizes: HFSX_BLOCK_SIZES
-};
-
-void
-ped_file_system_hfs_init ()
-{
-	ped_file_system_type_register (&hfs_type);
-	ped_file_system_type_register (&hfsplus_type);
-	ped_file_system_type_register (&hfsx_type);
-}
-
-void
-ped_file_system_hfs_done ()
-{
-	ped_file_system_type_unregister (&hfs_type);
-	ped_file_system_type_unregister (&hfsplus_type);
-	ped_file_system_type_unregister (&hfsx_type);
-}
-#endif
-- 
2.26.2




More information about the parted-devel mailing list