3
0
forked from pool/util-linux
util-linux/util-linux-ng-2.16-squashfs3-detect.patch
Marcus Meissner 1806747cca Accepting request 226509 from home:sbrabec:branches:Base:System
- Merge fixes and features from SLE11 (bnc#831868):
  * Detect squashfs version <= 3 as squashfs3 and version >= 4 as
    squashfs. (mszeredi@suse.cz,
    util-linux-ng-2.16-squashfs3-detect.patch, bnc#666893)
  * add sfdisk-warn-about-2TB-limit.patch (puzel@novell.com,
    bnc#495657)
  * Document barrier option in mount.8 (jack@suse.cz,
    hvogel@suse.de,
    util-linux-ng-2.19.1-barrier_documentation.patch, bnc#489740)
  * lscpu: improve hypervisor detection (puzel@novell.com,
    fate#310255)
    - util-linux-lscpu-improve-hypervisor-detection.patch
  * umount: avoid calling readlink on mountpoints if not necessary
    - add: umount-avoid-readlink.patch (puzel@suse.com, bnc#794529)
  * fix file conflict between util-linux and s390-32
    (puzel@suse.com, bnc#805684)
  * util-linux-update-default-commit-interval.patch:
    mount(8): update default commit interval (puzel@suse.com,
    bnc#809480)
  * Obsolete no more packaged uuid-runtime.
- Add uname26 (util-linux-setarch-uname26.patch, FATE#313476).

OBS-URL: https://build.opensuse.org/request/show/226509
OBS-URL: https://build.opensuse.org/package/show/Base:System/util-linux?expand=0&rev=227
2014-03-20 08:19:43 +00:00

119 lines
3.5 KiB
Diff

---
shlibs/blkid/src/superblocks/superblocks.c | 1
shlibs/blkid/src/superblocks/superblocks.h | 1
shlibs/blkid/src/superblocks/squashfs.c | 63 +++++++++++++++++++++++++++---------
3 files changed, 50 insertions(+), 15 deletions(-)
Index: util-linux-2.19/shlibs/blkid/src/superblocks/superblocks.c
===================================================================
--- util-linux-2.19.orig/libblkid/src/superblocks/superblocks.c
+++ util-linux-2.19/libblkid/src/superblocks/superblocks.c
@@ -131,6 +131,7 @@ static const struct blkid_idinfo *idinfo
&oracleasm_idinfo,
&vxfs_idinfo,
&squashfs_idinfo,
+ &squashfs3_idinfo,
&netware_idinfo,
&btrfs_idinfo,
&ubifs_idinfo,
Index: util-linux-2.19/shlibs/blkid/src/superblocks/superblocks.h
===================================================================
--- util-linux-2.19.orig/libblkid/src/superblocks/superblocks.h
+++ util-linux-2.19/libblkid/src/superblocks/superblocks.h
@@ -54,6 +54,7 @@ extern const struct blkid_idinfo luks_id
extern const struct blkid_idinfo highpoint37x_idinfo;
extern const struct blkid_idinfo highpoint45x_idinfo;
extern const struct blkid_idinfo squashfs_idinfo;
+extern const struct blkid_idinfo squashfs3_idinfo;
extern const struct blkid_idinfo netware_idinfo;
extern const struct blkid_idinfo sysv_idinfo;
extern const struct blkid_idinfo xenix_idinfo;
Index: util-linux-2.19/shlibs/blkid/src/superblocks/squashfs.c
===================================================================
--- util-linux-2.19.orig/libblkid/src/superblocks/squashfs.c
+++ util-linux-2.19/libblkid/src/superblocks/squashfs.c
@@ -31,20 +31,46 @@ struct sqsh_super_block {
static int probe_squashfs(blkid_probe pr, const struct blkid_idmag *mag)
{
struct sqsh_super_block *sq;
+ uint16_t major;
+ uint16_t minor;
sq = blkid_probe_get_sb(pr, mag, struct sqsh_super_block);
if (!sq)
return -1;
- if (strcmp(mag->magic, "sqsh") == 0 ||
- strcmp(mag->magic, "qshs") == 0)
- blkid_probe_sprintf_version(pr, "%u.%u",
- sq->s_major,
- sq->s_minor);
- else
- blkid_probe_sprintf_version(pr, "%u.%u",
- swab16(sq->s_major),
- swab16(sq->s_minor));
+ major = le16_to_cpu(sq->s_major);
+ minor = le16_to_cpu(sq->s_minor);
+ if (major < 4)
+ return -1;
+
+ blkid_probe_sprintf_version(pr, "%u.%u", major, minor);
+
+ return 0;
+}
+
+static int probe_squashfs3(blkid_probe pr, const struct blkid_idmag *mag)
+{
+ struct sqsh_super_block *sq;
+ uint16_t major;
+ uint16_t minor;
+
+ sq = blkid_probe_get_sb(pr, mag, struct sqsh_super_block);
+ if (!sq)
+ return -1;
+
+ if (strcmp(mag->magic, "sqsh") == 0) {
+ major = be16_to_cpu(sq->s_major);
+ minor = be16_to_cpu(sq->s_minor);
+ } else {
+ major = le16_to_cpu(sq->s_major);
+ minor = le16_to_cpu(sq->s_minor);
+ }
+
+ if (major > 3)
+ return -1;
+
+ blkid_probe_sprintf_version(pr, "%u.%u", major, minor);
+
return 0;
}
@@ -55,14 +81,21 @@ const struct blkid_idinfo squashfs_idinf
.probefunc = probe_squashfs,
.magics =
{
- { .magic = "sqsh", .len = 4 },
- { .magic = "hsqs", .len = 4 }, /* swap */
-
- /* LZMA version */
- { .magic = "qshs", .len = 4 },
- { .magic = "shsq", .len = 4 }, /* swap */
+ { .magic = "hsqs", .len = 4 },
{ NULL }
}
};
+const struct blkid_idinfo squashfs3_idinfo =
+{
+ .name = "squashfs3",
+ .usage = BLKID_USAGE_FILESYSTEM,
+ .probefunc = probe_squashfs3,
+ .magics =
+ {
+ { .magic = "sqsh", .len = 4 }, /* big endian */
+ { .magic = "hsqs", .len = 4 }, /* little endian */
+ { NULL }
+ }
+};