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

« back to all changes in this revision

Viewing changes to debian/patches/freebsd-ufs.patch

  • 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:
1
 
From 2e9ce0ee1065b70d0b0d422e5ec4bdee4fb1548d Mon Sep 17 00:00:00 2001
 
1
From bfbc311a960a094aacc06995caf9739e6034271a Mon Sep 17 00:00:00 2001
2
2
From: Aurelien Jarno <aurelien@aurel32.net>
3
3
Date: Fri, 28 Mar 2014 17:09:46 +0000
4
4
Subject: Add FreeBSD UFS support
13
13
This patch is used by debian-installer on Debian GNU/kFreeBSD for some
14
14
months already.
15
15
 
16
 
Last-Update: 2014-07-07
 
16
Last-Update: 2014-08-25
17
17
 
18
18
Patch-Name: freebsd-ufs.patch
19
19
---
26
26
 create mode 100644 tests/t2500-freebsd-ufs.sh
27
27
 
28
28
diff --git a/libparted/fs/ufs/ufs.c b/libparted/fs/ufs/ufs.c
29
 
index cf0f441..b79c24f 100644
 
29
index cf0f441..54c5bd5 100644
30
30
--- a/libparted/fs/ufs/ufs.c
31
31
+++ b/libparted/fs/ufs/ufs.c
32
32
@@ -44,6 +44,7 @@
103
103
+ufs_probe_freebsd (PedGeometry* geom)
104
104
+{
105
105
+       int offsets[] = { 0, 16, 128, 512 };
106
 
+       int8_t buf[512 * 3];
 
106
+       char *buf = alloca (3 * geom->dev->sector_size);
107
107
+       struct ufs_super_block *sb;
108
108
+       PedSector block_size;
109
109
+       PedSector block_count;
121
121
+
122
122
+               /* Little endian is more likely on FreeBSD boxes */
123
123
+               if (PED_LE32_TO_CPU(sb->fs_magic) == UFS2_MAGIC) {
124
 
+                       block_size = PED_LE32_TO_CPU(sb->fs_fsize) / 512;
 
124
+                       block_size = PED_LE32_TO_CPU(sb->fs_fsize) / geom->dev->sector_size;
125
125
+                       block_count = PED_LE32_TO_CPU(sb->fs_u11.fs_u2.fs_size);
126
126
+                       return ped_geometry_new (geom->dev, geom->start,
127
127
+                                                block_size * block_count);
129
129
+
130
130
+               /* Then try big endian */
131
131
+               if (PED_BE32_TO_CPU(sb->fs_magic) == UFS2_MAGIC) {
132
 
+                       block_size = PED_BE32_TO_CPU(sb->fs_fsize) / 512;
 
132
+                       block_size = PED_BE32_TO_CPU(sb->fs_fsize) / geom->dev->sector_size;
133
133
+                       block_count = PED_BE32_TO_CPU(sb->fs_u11.fs_u2.fs_size);
134
134
+                       return ped_geometry_new (geom->dev, geom->start,
135
135
+                                                block_size * block_count);