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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux