public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: util-linux@vger.kernel.org
Subject: [PATCH] Support UFS UUID
Date: Thu, 03 May 2012 14:40:42 +0200	[thread overview]
Message-ID: <4FA27CCA.1060500@gmail.com> (raw)


[-- 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 --]

             reply	other threads:[~2012-05-03 12:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-03 12:40 Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2012-05-04  9:51 ` [PATCH] Support UFS UUID Karel Zak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FA27CCA.1060500@gmail.com \
    --to=phcoder@gmail.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox