summaryrefslogtreecommitdiff
path: root/libparted/fs/r/hfs/probe.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2012-03-02 12:29:04 +0100
committerJim Meyering <meyering@redhat.com>2012-03-02 12:39:05 +0100
commit4e6ad5461660c1dc3d97a0d76e7dabea0aebd26f (patch)
treed2b4ccbd4111d0c632548d29a38134d1efc5e2ed /libparted/fs/r/hfs/probe.c
parent4559c510f02a691d90329fd646e8eefe2e73e6d2 (diff)
downloadparted-4e6ad5461660c1dc3d97a0d76e7dabea0aebd26f.tar.gz
lib-fs-resize: remove unused probe-related code
* libparted/fs/r/hfs/probe.c: Remove probe-related functions. There are not used. * libparted/fs/r/fat/fat.c: Likewise. * libparted/fs/r/hfs/probe.h: ...and declarations.
Diffstat (limited to 'libparted/fs/r/hfs/probe.c')
-rw-r--r--libparted/fs/r/hfs/probe.c132
1 files changed, 0 insertions, 132 deletions
diff --git a/libparted/fs/r/hfs/probe.c b/libparted/fs/r/hfs/probe.c
index cc422b9..376a821 100644
--- a/libparted/fs/r/hfs/probe.c
+++ b/libparted/fs/r/hfs/probe.c
@@ -96,135 +96,3 @@ hfs_and_wrapper_probe (PedGeometry* geom)
ped_geometry_destroy (geom_ret);
return NULL;
}
-
-PedGeometry*
-hfsplus_probe (PedGeometry* geom)
-{
- PedGeometry* geom_ret;
- uint8_t buf[PED_SECTOR_SIZE_DEFAULT];
-
- PED_ASSERT (geom != NULL);
-
- if (!hfsc_can_use_geom (geom))
- return NULL;
-
- if ((geom_ret = hfs_and_wrapper_probe(geom))) {
- /* HFS+ is embedded in an HFS volume ? */
- HfsMasterDirectoryBlock *mdb;
- mdb = (HfsMasterDirectoryBlock *) buf;
-
- if (!ped_geometry_read (geom, buf, 2, 1)
- || (mdb->old_new.embedded.signature
- != PED_CPU_TO_BE16 (HFSP_SIGNATURE))) {
- ped_geometry_destroy (geom_ret);
- return NULL;
- } else
- return geom_ret;
- } else {
- /* This is a standalone HFS+ volume ? */
- PedSector search, max;
- HfsPVolumeHeader *vh;
- vh = (HfsPVolumeHeader *) buf;
-
- if ((geom->length < 5)
- || !ped_geometry_read (geom, buf, 2, 1)
- || (vh->signature != PED_CPU_TO_BE16 (HFSP_SIGNATURE)))
- return NULL;
-
- /* Correct range is indeed [ blocks*sz-2;(blocs+1)*sz-2 ( */
- /* But previous versions of my implementation used to */
- /* assume range is [(blocks-1)*sz-1;(blocks*sz) ( */
- /* (blocks-1)*sz-1 has to be scanned last, because */
- /* it can belong to a regular file */
- max = ((PedSector) PED_BE32_TO_CPU (vh->total_blocks) + 1)
- * ( PED_BE32_TO_CPU (vh->block_size) / PED_SECTOR_SIZE_DEFAULT )
- - 2;
- search = max - 2 * ( PED_BE32_TO_CPU (vh->block_size)
- / PED_SECTOR_SIZE_DEFAULT ) + 2;
- if (!(geom_ret = ped_geometry_new (geom->dev, geom->start,
- search + 2)))
- return NULL;
-
- for (; search < max; search++) {
- if (!ped_geometry_set (geom_ret, geom_ret->start,
- search + 2)
- || !ped_geometry_read (geom_ret, buf, search, 1))
- break;
- if (vh->signature == PED_CPU_TO_BE16 (HFSP_SIGNATURE))
- return geom_ret;
- }
- search = ((PedSector) PED_BE32_TO_CPU (vh->total_blocks) - 1)
- * ( PED_BE32_TO_CPU (vh->block_size) / PED_SECTOR_SIZE_DEFAULT )
- - 1;
- if (!ped_geometry_set (geom_ret, geom_ret->start,
- search + 2)
- || !ped_geometry_read (geom_ret, buf, search, 1)
- || vh->signature != PED_CPU_TO_BE16 (HFSP_SIGNATURE)) {
- ped_geometry_destroy (geom_ret);
- return NULL;
- } else
- return geom_ret;
- }
-}
-
-PedGeometry*
-hfs_probe (PedGeometry* geom)
-{
- PedGeometry* geom_base;
- PedGeometry* geom_plus = NULL;
-
- PED_ASSERT (geom != NULL);
-
- if (!hfsc_can_use_geom (geom))
- return NULL;
-
- if ((geom_base = hfs_and_wrapper_probe(geom))
- && (!(geom_plus = hfsplus_probe(geom_base))))
- return geom_base;
- else {
- if (geom_base) ped_geometry_destroy (geom_base);
- if (geom_plus) ped_geometry_destroy (geom_plus);
- return NULL;
- }
-}
-
-PedGeometry*
-hfsx_probe (PedGeometry* geom)
-{
- PedGeometry* geom_ret;
- uint8_t buf[PED_SECTOR_SIZE_DEFAULT];
- PedSector search, max;
- HfsPVolumeHeader *vh = (HfsPVolumeHeader *) buf;
-
- PED_ASSERT (geom != NULL);
-
- if (!hfsc_can_use_geom (geom))
- return NULL;
-
- if ((geom->length < 5)
- || !ped_geometry_read (geom, buf, 2, 1)
- || (vh->signature != PED_CPU_TO_BE16 (HFSX_SIGNATURE)))
- return NULL;
-
- /* unlike the hfs+ code, which should be kept compatible
- with my old previous implementations, we only care here
- about legal alternate VH positions, like TN1150 describes them */
- max = ((PedSector) PED_BE32_TO_CPU (vh->total_blocks) + 1)
- * ( PED_BE32_TO_CPU (vh->block_size) / PED_SECTOR_SIZE_DEFAULT )
- - 2;
- search = max - ( PED_BE32_TO_CPU (vh->block_size) / PED_SECTOR_SIZE_DEFAULT );
- if (!(geom_ret = ped_geometry_new (geom->dev, geom->start,
- search + 2)))
- return NULL;
- for (; search < max; search++) {
- if (!ped_geometry_set (geom_ret, geom_ret->start,
- search + 2)
- || !ped_geometry_read (geom_ret, buf, search, 1))
- break;
- if (vh->signature == PED_CPU_TO_BE16 (HFSX_SIGNATURE))
- return geom_ret;
- }
-
- ped_geometry_destroy (geom_ret);
- return NULL;
-}