[PATCH] squashfs: generate uuid for the superblock rather than leaving it zero

From: Colin King
Date: Thu Nov 07 2019 - 10:58:05 EST


From: Colin Ian King <colin.king@xxxxxxxxxxxxx>

The squashfs superblock uuid is currently all zero and it can be useful
to have this set. Generate the uuid based on some of squashfs superblock
data to produce a reasonable uuid pattern.

Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>
---
fs/squashfs/super.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c
index 0cc4ceec0562..ac9d17e05fac 100644
--- a/fs/squashfs/super.c
+++ b/fs/squashfs/super.c
@@ -193,6 +193,12 @@ static int squashfs_fill_super(struct super_block *sb, struct fs_context *fc)

err = -ENOMEM;

+ memcpy(&sb->s_uuid.b[0], &sblk->inodes, 4);
+ memcpy(&sb->s_uuid.b[4], &sblk->mkfs_time, 4);
+ memcpy(&sb->s_uuid.b[8], &sblk->fragments, 4);
+ memcpy(&sb->s_uuid.b[12], &sblk->compression, 2);
+ memcpy(&sb->s_uuid.b[14], &sblk->block_log, 2);
+
msblk->block_cache = squashfs_cache_init("metadata",
SQUASHFS_CACHED_BLKS, SQUASHFS_METADATA_SIZE);
if (msblk->block_cache == NULL)
--
2.20.1