]> err.no Git - util-linux/commitdiff
blkid: add romfs
authorKarel Zak <kzak@redhat.com>
Tue, 23 Sep 2008 13:40:12 +0000 (15:40 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 11 Feb 2009 22:21:45 +0000 (23:21 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
libs/blkid/src/probe.c
libs/blkid/src/probers/Makefile.am
libs/blkid/src/probers/probers.h
libs/blkid/src/probers/romfs.c [new file with mode: 0644]

index ebac6bbc2796e9215957279535a836299096c942..d4f966dd96f13c993ad37e323acaeae14ff53561 100644 (file)
@@ -57,6 +57,7 @@ static const struct blkid_idinfo *idinfos[] =
        &jfs_idinfo,
        &gfs_idinfo,
        &gfs2_idinfo,
+       &romfs_idinfo,
        &jbd_idinfo
 };
 
index 663700b0305e4a429df6a9b35eec7280a799c28f..9055d0d6318a1cf8f07320484e758fe47ab9889d 100644 (file)
@@ -20,6 +20,7 @@ libprobers_a_SOURCES =        probers.h \
                        jfs.c \
                        xfs.c \
                        ext.c \
-                       gfs.c
+                       gfs.c \
+                       romfs.c
 
 all-local: $(lib_LIBRARIES)
index 1c8b5f21ac9ff0f08b46ce46541ba4f1a527ba95..45a1e668b9d616ad96248795e41dd7386228d16a 100644 (file)
@@ -37,5 +37,6 @@ extern const struct blkid_idinfo jfs_idinfo;
 extern const struct blkid_idinfo xfs_idinfo;
 extern const struct blkid_idinfo gfs_idinfo;
 extern const struct blkid_idinfo gfs2_idinfo;
+extern const struct blkid_idinfo romfs_idinfo;
 
 #endif /* _BLKID_PROBE_H */
diff --git a/libs/blkid/src/probers/romfs.c b/libs/blkid/src/probers/romfs.c
new file mode 100644 (file)
index 0000000..318fd56
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 1999, 2001 by Andries Brouwer
+ * Copyright (C) 1999, 2000, 2003 by Theodore Ts'o
+ * Copyright (C) 2008 Karel Zak <kzak@redhat.com>
+ *
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This file is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <ctype.h>
+#include <stdint.h>
+
+#include "blkidP.h"
+
+struct romfs_super_block {
+       unsigned char   ros_magic[8];
+       uint32_t        ros_dummy1[2];
+       unsigned char   ros_volume[16];
+};
+
+static int probe_romfs(blkid_probe pr, const struct blkid_idmag *mag)
+{
+       struct romfs_super_block *ros;
+
+       ros = blkid_probe_get_sb(pr, mag, struct romfs_super_block);
+       if (!ros)
+               return -1;
+
+       if (strlen((char *) ros->ros_volume))
+               blkid_probe_set_label(pr, ros->ros_volume,
+                               sizeof(ros->ros_volume));
+       return 0;
+}
+
+const struct blkid_idinfo romfs_idinfo =
+{
+       .name           = "romfs",
+       .usage          = BLKID_USAGE_FILESYSTEM,
+       .probefunc      = probe_romfs,
+       .magics         =
+       {
+               { .magic = "-rom1fs-", .len = 8 },
+               { NULL }
+       }
+};
+