public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Support UFS UUID
@ 2012-05-03 12:40 Vladimir 'φ-coder/phcoder' Serbinenko
  2012-05-04  9:51 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir 'φ-coder/phcoder' Serbinenko @ 2012-05-03 12:40 UTC (permalink / raw)
  To: util-linux


[-- Attachment #1.1: Type: text/plain, Size: 58 bytes --]


-- 
Regards
Vladimir 'φ-coder/phcoder' Serbinenko


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: ufs_blkid.diff --]
[-- Type: text/x-diff; name="ufs_blkid.diff", Size: 1292 bytes --]

diff --git a/libblkid/src/superblocks/ufs.c b/libblkid/src/superblocks/ufs.c
index 3ace715..673a528 100644
--- a/libblkid/src/superblocks/ufs.c
+++ b/libblkid/src/superblocks/ufs.c
@@ -174,6 +174,7 @@ static int probe_ufs(blkid_probe pr,
 	size_t i;
 	uint32_t magic;
 	struct ufs_super_block *ufs;
+	int is_be;
 
 	for (i = 0; i < ARRAY_SIZE(offsets); i++) {
 		uint32_t magLE, magBE;
@@ -192,6 +193,7 @@ static int probe_ufs(blkid_probe pr,
 		for (y = 0; y < ARRAY_SIZE(mags); y++) {
 			if (magLE == mags[y] || magBE == mags[y]) {
 				magic = mags[y];
+				is_be = (magBE == mags[y]);
 				goto found;
 			}
 		}
@@ -206,6 +208,23 @@ found:
 				sizeof(ufs->fs_u11.fs_u2.fs_volname));
 	} else
 		blkid_probe_set_version(pr, "1");
+	if (ufs->fs_id[0] || ufs->fs_id[1])
+	{
+		if (is_be)
+			blkid_probe_sprintf_uuid(pr,
+					 (unsigned char *) &ufs->fs_id,
+						 sizeof(ufs->fs_id),
+						 "%08x%08x",
+						 be32_to_cpu(ufs->fs_id[0]),
+						 be32_to_cpu(ufs->fs_id[1]));
+		else
+			blkid_probe_sprintf_uuid(pr,
+					 (unsigned char *) &ufs->fs_id,
+						 sizeof(ufs->fs_id),
+						 "%08x%08x",
+						 le32_to_cpu(ufs->fs_id[0]),
+						 le32_to_cpu(ufs->fs_id[1]));
+	}
 
 	if (blkid_probe_set_magic(pr,
 			(offsets[i] * 1024) +

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Support UFS UUID
  2012-05-03 12:40 [PATCH] Support UFS UUID Vladimir 'φ-coder/phcoder' Serbinenko
@ 2012-05-04  9:51 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2012-05-04  9:51 UTC (permalink / raw)
  To: Vladimir 'φ-coder/phcoder' Serbinenko; +Cc: util-linux

On Thu, May 03, 2012 at 02:40:42PM +0200, Vladimir 'φ-coder/phcoder' Serbinenko wrote:
> diff --git a/libblkid/src/superblocks/ufs.c b/libblkid/src/superblocks/ufs.c

 Applied, thanks.

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-05-04  9:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-03 12:40 [PATCH] Support UFS UUID Vladimir 'φ-coder/phcoder' Serbinenko
2012-05-04  9:51 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox