static PedGeometry* jfs_probe (PedGeometry* geom) { union { struct superblock sb; char bytes[512]; } buf; /* FIXME: for now, don't even try to deal with larger sector size. */ if (geom->dev->sector_size != PED_SECTOR_SIZE_DEFAULT) return NULL; if (geom->length < JFS_SUPER_SECTOR + 1) return NULL; if (!ped_geometry_read (geom, &buf, JFS_SUPER_SECTOR, 1)) return NULL; if (strncmp (buf.sb.s_magic, JFS_MAGIC, 4) == 0) { PedSector block_size = PED_LE32_TO_CPU (buf.sb.s_pbsize) / 512; PedSector block_count = PED_LE64_TO_CPU (buf.sb.s_size); return ped_geometry_new (geom->dev, geom->start, block_size * block_count); } else { return NULL; } }
static PedGeometry* xfs_probe (PedGeometry* geom) { PedSector block_size; PedSector block_count; union { struct xfs_sb sb; char bytes [512]; } buf; if (geom->length < XFS_SB_DADDR + 1) return NULL; if (!ped_geometry_read (geom, &buf, XFS_SB_DADDR, 1)) return NULL; if (PED_LE32_TO_CPU (buf.sb.sb_magicnum) == XFS_SB_MAGIC) { block_size = PED_LE32_TO_CPU (buf.sb.sb_blocksize) / 512; block_count = PED_LE64_TO_CPU (buf.sb.sb_dblocks); return ped_geometry_new (geom->dev, geom->start, block_size * block_count); } if (PED_BE32_TO_CPU (buf.sb.sb_magicnum) == XFS_SB_MAGIC) { block_size = PED_BE32_TO_CPU (buf.sb.sb_blocksize) / 512; block_count = PED_BE64_TO_CPU (buf.sb.sb_dblocks); return ped_geometry_new (geom->dev, geom->start, block_size * block_count); } return NULL; }
static PedGeometry* ntfs_probe (PedGeometry* geom) { char buf[512]; if (!ped_geometry_read (geom, buf, 0, 1)) return 0; if (strncmp (NTFS_SIGNATURE, buf + 3, strlen (NTFS_SIGNATURE)) == 0) return ped_geometry_new (geom->dev, geom->start, PED_LE64_TO_CPU (*(uint64_t*) (buf + 0x28))); else return NULL; }
static PedGeometry* jfs_probe (PedGeometry* geom) { union { struct superblock sb; char bytes[512]; } buf; if (geom->length < JFS_SUPER_SECTOR + 1) return NULL; if (!ped_geometry_read (geom, &buf, JFS_SUPER_SECTOR, 1)) return NULL; if (strncmp (buf.sb.s_magic, JFS_MAGIC, 4) == 0) { PedSector block_size = PED_LE32_TO_CPU (buf.sb.s_pbsize) / 512; PedSector block_count = PED_LE64_TO_CPU (buf.sb.s_size); return ped_geometry_new (geom->dev, geom->start, block_size * block_count); } else { return NULL; } }