~ubuntu-branches/ubuntu/vivid/parted/vivid

« back to all changes in this revision

Viewing changes to libparted/fs/ufs/ufs.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2014-08-25 19:20:11 UTC
  • mfrom: (7.2.38 sid)
  • Revision ID: package-import@ubuntu.com-20140825192011-hgbo5yqhjywlr69y
Tags: 3.2-5
Update freebsd-ufs.patch to handle non-512-byte-sector disks
(LP: #1355127).

Show diffs side-by-side

added added

removed removed

Lines of Context:
285
285
ufs_probe_freebsd (PedGeometry* geom)
286
286
{
287
287
        int offsets[] = { 0, 16, 128, 512 };
288
 
        int8_t buf[512 * 3];
 
288
        char *buf = alloca (3 * geom->dev->sector_size);
289
289
        struct ufs_super_block *sb;
290
290
        PedSector block_size;
291
291
        PedSector block_count;
303
303
 
304
304
                /* Little endian is more likely on FreeBSD boxes */
305
305
                if (PED_LE32_TO_CPU(sb->fs_magic) == UFS2_MAGIC) {
306
 
                        block_size = PED_LE32_TO_CPU(sb->fs_fsize) / 512;
 
306
                        block_size = PED_LE32_TO_CPU(sb->fs_fsize) / geom->dev->sector_size;
307
307
                        block_count = PED_LE32_TO_CPU(sb->fs_u11.fs_u2.fs_size);
308
308
                        return ped_geometry_new (geom->dev, geom->start,
309
309
                                                 block_size * block_count);
311
311
 
312
312
                /* Then try big endian */
313
313
                if (PED_BE32_TO_CPU(sb->fs_magic) == UFS2_MAGIC) {
314
 
                        block_size = PED_BE32_TO_CPU(sb->fs_fsize) / 512;
 
314
                        block_size = PED_BE32_TO_CPU(sb->fs_fsize) / geom->dev->sector_size;
315
315
                        block_count = PED_BE32_TO_CPU(sb->fs_u11.fs_u2.fs_size);
316
316
                        return ped_geometry_new (geom->dev, geom->start,
317
317
                                                 block_size * block_count);