From 95f9229777fb15c922176d92deda51f454117a53 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 23 Sep 2008 15:40:12 +0200 Subject: [PATCH] blkid: add romfs Signed-off-by: Karel Zak --- libs/blkid/src/probe.c | 1 + libs/blkid/src/probers/Makefile.am | 3 +- libs/blkid/src/probers/probers.h | 1 + libs/blkid/src/probers/romfs.c | 58 ++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 libs/blkid/src/probers/romfs.c diff --git a/libs/blkid/src/probe.c b/libs/blkid/src/probe.c index ebac6bbc..d4f966dd 100644 --- a/libs/blkid/src/probe.c +++ b/libs/blkid/src/probe.c @@ -57,6 +57,7 @@ static const struct blkid_idinfo *idinfos[] = &jfs_idinfo, &gfs_idinfo, &gfs2_idinfo, + &romfs_idinfo, &jbd_idinfo }; diff --git a/libs/blkid/src/probers/Makefile.am b/libs/blkid/src/probers/Makefile.am index 663700b0..9055d0d6 100644 --- a/libs/blkid/src/probers/Makefile.am +++ b/libs/blkid/src/probers/Makefile.am @@ -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) diff --git a/libs/blkid/src/probers/probers.h b/libs/blkid/src/probers/probers.h index 1c8b5f21..45a1e668 100644 --- a/libs/blkid/src/probers/probers.h +++ b/libs/blkid/src/probers/probers.h @@ -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 index 00000000..318fd56b --- /dev/null +++ b/libs/blkid/src/probers/romfs.c @@ -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 + * + * 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 +#include +#include +#include +#include +#include +#include + +#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 } + } +}; + -- 2.39.5