Fix XFS superblock definition.  Add support to
extract UUID and labels for JFS and romfs.  (Thanks to
Janos Farkas <chexum@acomp.hu>.)

diff --git a/lib/blkid/ChangeLog b/lib/blkid/ChangeLog
index f34f518..9e408a2 100644
--- a/lib/blkid/ChangeLog
+++ b/lib/blkid/ChangeLog
@@ -1,3 +1,9 @@
+2003-04-02  Theodore Ts'o  <tytso@mit.edu>
+
+	* probe.c, probe.h: Fix XFS superblock definition.  Add support to
+		extract UUID and labels for JFS and romfs.  (Thanks to
+		Janos Farkas <chexum@acomp.hu>.)
+
 2003-03-30  Theodore Ts'o  <tytso@mit.edu>
 
 	* getsize.c: #include stat.h for the Apple Darwin port
diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c
index 2484a5f..0fbbda3 100644
--- a/lib/blkid/probe.c
+++ b/lib/blkid/probe.c
@@ -213,6 +213,35 @@
 	return 0;
 }
 
+static int probe_jfs(int fd, blkid_cache cache, blkid_dev dev,
+		     struct blkid_magic *id, unsigned char *buf)
+{
+	struct jfs_super_block *js;
+
+	js = (struct jfs_super_block *)buf;
+
+	if (strlen(js->js_label))
+		blkid_set_tag(dev, "LABEL", js->js_label,
+			      sizeof(js->js_label));
+	set_uuid(dev, js->js_uuid);
+	return 0;
+}
+
+static int probe_romfs(int fd, blkid_cache cache, blkid_dev dev,
+		       struct blkid_magic *id, unsigned char *buf)
+{
+	struct romfs_super_block *ros;
+
+	ros = (struct romfs_super_block *)buf;
+
+	/* can be longer, padded to a 16 bytes boundary */
+	if (strlen(ros->ros_volume)) {
+		blkid_set_tag(dev, "LABEL", ros->ros_volume,
+			      (strlen(ros->ros_volume)|15)+1);
+	}
+	return 0;
+}
+
 /*
  * BLKID_BLK_OFFS is at least as large as the highest bim_kboff defined
  * in the type_array table below + bim_kbalign.
@@ -248,7 +277,7 @@
   { "minix",	 1,   0x10,  2, "\170\044",		0 },
   { "vxfs",	 1,	 0,  4, "\365\374\001\245",	0 },
   { "xfs",	 0,	 0,  4, "XFSB",			probe_xfs },
-  { "romfs",	 0,	 0,  8, "-rom1fs-",		0 },
+  { "romfs",	 0,	 0,  8, "-rom1fs-",		probe_romfs },
   { "bfs",	 0,	 0,  4, "\316\372\173\033",	0 },
   { "cramfs",	 0,	 0,  4, "E=\315\034",		0 },
   { "qnx4",	 0,	 4,  6, "QNX4FS",		0 },
@@ -261,7 +290,7 @@
   { "udf",	32,	 1,  5, "NSR02",		0 },
   { "udf",	32,	 1,  5, "NSR03",		0 },
   { "udf",	32,	 1,  5, "TEA01",		0 },
-  { "jfs",	32,	 0,  4, "JFS1",			0 },
+  { "jfs",	32,	 0,  4, "JFS1",			probe_jfs },
   { "hfs",	 1,	 0,  2, "BD",			0 },
   { "ufs",	 8,  0x55c,  4, "T\031\001\000",	0 },
   { "hpfs",	 8,	 0,  4, "I\350\225\371",	0 },
diff --git a/lib/blkid/probe.h b/lib/blkid/probe.h
index 8302b3f..8ab8d72 100644
--- a/lib/blkid/probe.h
+++ b/lib/blkid/probe.h
@@ -63,7 +63,7 @@
 	__u32		xs_blocksize;
 	__u64		xs_dblocks;
 	__u64		xs_rblocks;
-	__u32		xs_dummy1[8];
+	__u32		xs_dummy1[2];
 	unsigned char	xs_uuid[16];
 	__u32		xs_dummy2[15];
 	char		xs_fname[12];
@@ -89,6 +89,25 @@
 	char		rs_label[16];
 };
 
+struct jfs_super_block {
+	unsigned char	js_magic[4];
+	__u32		js_version;
+	__u64		js_size;
+	__u32		js_bsize;
+	__u32		js_dummy1;
+	__u32		js_pbsize;
+	__u32		js_dummy2[27];
+	unsigned char	js_uuid[16];
+	unsigned char	js_label[16];
+	unsigned char	js_loguuid[16];
+};
+
+struct romfs_super_block {
+	unsigned char	ros_magic[8];
+	__u32		ros_dummy1[2];
+	unsigned char	ros_volume[16];
+};
+
 /* Yucky misaligned values */
 struct vfat_super_block {
 /* 00*/	unsigned char	vs_ignored[3];