summaryrefslogtreecommitdiff
path: root/extras/volume_id
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2006-03-27 17:59:22 +0200
committerKay Sievers <kay.sievers@suse.de>2006-03-27 17:59:22 +0200
commitb5e694267142042228a6cac99ecad6c4b4ef8759 (patch)
tree139b842ae9982dd14b649cf84346795c8cf5db8d /extras/volume_id
parent727f3fb091cf4903e9e9aa21159f05c36aaede24 (diff)
volume_id: provide a custom debug function
Diffstat (limited to 'extras/volume_id')
-rw-r--r--extras/volume_id/libvolume_id/Makefile2
-rw-r--r--extras/volume_id/libvolume_id/cramfs.c1
-rw-r--r--extras/volume_id/libvolume_id/ext.c1
-rw-r--r--extras/volume_id/libvolume_id/fat.c1
-rw-r--r--extras/volume_id/libvolume_id/hfs.c1
-rw-r--r--extras/volume_id/libvolume_id/highpoint.c1
-rw-r--r--extras/volume_id/libvolume_id/hpfs.c1
-rw-r--r--extras/volume_id/libvolume_id/iso9660.c1
-rw-r--r--extras/volume_id/libvolume_id/isw_raid.c1
-rw-r--r--extras/volume_id/libvolume_id/jfs.c1
-rw-r--r--extras/volume_id/libvolume_id/libvolume_id.h6
-rw-r--r--extras/volume_id/libvolume_id/linux_raid.c1
-rw-r--r--extras/volume_id/libvolume_id/linux_swap.c1
-rw-r--r--extras/volume_id/libvolume_id/logging.h24
-rw-r--r--extras/volume_id/libvolume_id/lsi_raid.c1
-rw-r--r--extras/volume_id/libvolume_id/luks.c1
-rw-r--r--extras/volume_id/libvolume_id/lvm.c1
-rw-r--r--extras/volume_id/libvolume_id/minix.c1
-rw-r--r--extras/volume_id/libvolume_id/ntfs.c1
-rw-r--r--extras/volume_id/libvolume_id/nvidia_raid.c1
-rw-r--r--extras/volume_id/libvolume_id/ocfs.c1
-rw-r--r--extras/volume_id/libvolume_id/promise_raid.c1
-rw-r--r--extras/volume_id/libvolume_id/reiserfs.c1
-rw-r--r--extras/volume_id/libvolume_id/romfs.c1
-rw-r--r--extras/volume_id/libvolume_id/silicon_raid.c1
-rw-r--r--extras/volume_id/libvolume_id/squashfs.c1
-rw-r--r--extras/volume_id/libvolume_id/sysv.c1
-rw-r--r--extras/volume_id/libvolume_id/udf.c1
-rw-r--r--extras/volume_id/libvolume_id/ufs.c1
-rw-r--r--extras/volume_id/libvolume_id/util.c1
-rw-r--r--extras/volume_id/libvolume_id/util.h11
-rw-r--r--extras/volume_id/libvolume_id/via_raid.c1
-rw-r--r--extras/volume_id/libvolume_id/volume_id.c8
-rw-r--r--extras/volume_id/libvolume_id/vxfs.c1
-rw-r--r--extras/volume_id/libvolume_id/xfs.c1
-rw-r--r--extras/volume_id/vol_id.c15
36 files changed, 39 insertions, 57 deletions
diff --git a/extras/volume_id/libvolume_id/Makefile b/extras/volume_id/libvolume_id/Makefile
index 5d188a23d4..6a12f0e67a 100644
--- a/extras/volume_id/libvolume_id/Makefile
+++ b/extras/volume_id/libvolume_id/Makefile
@@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644
INSTALL_LIB = ${INSTALL} -m 755
SHLIB_CUR = 0
-SHLIB_REV = 60
+SHLIB_REV = 61
SHLIB_AGE = 0
SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE)
diff --git a/extras/volume_id/libvolume_id/cramfs.c b/extras/volume_id/libvolume_id/cramfs.c
index 5a7c29d353..beb34d5bc0 100644
--- a/extras/volume_id/libvolume_id/cramfs.c
+++ b/extras/volume_id/libvolume_id/cramfs.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct cramfs_super {
diff --git a/extras/volume_id/libvolume_id/ext.c b/extras/volume_id/libvolume_id/ext.c
index d1c46471c6..51c0011218 100644
--- a/extras/volume_id/libvolume_id/ext.c
+++ b/extras/volume_id/libvolume_id/ext.c
@@ -25,7 +25,6 @@
#include "libvolume_id.h"
#include "util.h"
-#include "logging.h"
struct ext2_super_block {
uint32_t s_inodes_count;
diff --git a/extras/volume_id/libvolume_id/fat.c b/extras/volume_id/libvolume_id/fat.c
index 4b32263fd6..4840a2a23c 100644
--- a/extras/volume_id/libvolume_id/fat.c
+++ b/extras/volume_id/libvolume_id/fat.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
#define FAT12_MAX 0xff5
diff --git a/extras/volume_id/libvolume_id/hfs.c b/extras/volume_id/libvolume_id/hfs.c
index 627166df98..a6e378dd28 100644
--- a/extras/volume_id/libvolume_id/hfs.c
+++ b/extras/volume_id/libvolume_id/hfs.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct hfs_finder_info{
diff --git a/extras/volume_id/libvolume_id/highpoint.c b/extras/volume_id/libvolume_id/highpoint.c
index fa580b7b8c..deba540ad5 100644
--- a/extras/volume_id/libvolume_id/highpoint.c
+++ b/extras/volume_id/libvolume_id/highpoint.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct hpt37x_meta {
diff --git a/extras/volume_id/libvolume_id/hpfs.c b/extras/volume_id/libvolume_id/hpfs.c
index 41b8013bb1..3e9589fcca 100644
--- a/extras/volume_id/libvolume_id/hpfs.c
+++ b/extras/volume_id/libvolume_id/hpfs.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct hpfs_super
diff --git a/extras/volume_id/libvolume_id/iso9660.c b/extras/volume_id/libvolume_id/iso9660.c
index 02575f8dc2..7b78a7e992 100644
--- a/extras/volume_id/libvolume_id/iso9660.c
+++ b/extras/volume_id/libvolume_id/iso9660.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
#define ISO_SUPERBLOCK_OFFSET 0x8000
diff --git a/extras/volume_id/libvolume_id/isw_raid.c b/extras/volume_id/libvolume_id/isw_raid.c
index cf7c62f817..6465a31bf5 100644
--- a/extras/volume_id/libvolume_id/isw_raid.c
+++ b/extras/volume_id/libvolume_id/isw_raid.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct isw_meta {
diff --git a/extras/volume_id/libvolume_id/jfs.c b/extras/volume_id/libvolume_id/jfs.c
index f8d857878d..b230fb258c 100644
--- a/extras/volume_id/libvolume_id/jfs.c
+++ b/extras/volume_id/libvolume_id/jfs.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct jfs_super_block {
diff --git a/extras/volume_id/libvolume_id/libvolume_id.h b/extras/volume_id/libvolume_id/libvolume_id.h
index b08a650dc8..7faf8d8af3 100644
--- a/extras/volume_id/libvolume_id/libvolume_id.h
+++ b/extras/volume_id/libvolume_id/libvolume_id.h
@@ -18,6 +18,12 @@
#define PACKED __attribute__((packed))
#endif
+
+typedef void (*volume_id_log_fn)(int priority, const char *file, int line, const char *format, ...)
+ __attribute__ ((format(printf, 4, 5)));
+
+extern volume_id_log_fn volume_id_log;
+
#define VOLUME_ID_LABEL_SIZE 64
#define VOLUME_ID_UUID_SIZE 36
#define VOLUME_ID_FORMAT_SIZE 32
diff --git a/extras/volume_id/libvolume_id/linux_raid.c b/extras/volume_id/libvolume_id/linux_raid.c
index ee5ed2875d..85e8d8109b 100644
--- a/extras/volume_id/libvolume_id/linux_raid.c
+++ b/extras/volume_id/libvolume_id/linux_raid.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct mdp_super_block {
diff --git a/extras/volume_id/libvolume_id/linux_swap.c b/extras/volume_id/libvolume_id/linux_swap.c
index c87ef63df9..0193648c9e 100644
--- a/extras/volume_id/libvolume_id/linux_swap.c
+++ b/extras/volume_id/libvolume_id/linux_swap.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct swap_header_v1_2 {
diff --git a/extras/volume_id/libvolume_id/logging.h b/extras/volume_id/libvolume_id/logging.h
deleted file mode 100644
index 4a8aa50d4c..0000000000
--- a/extras/volume_id/libvolume_id/logging.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * volume_id_logging - this file is used to map the dbg() function
- * to the user's logging facility
- *
- * This program 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 version 2 of the License.
- */
-
-#ifndef _VOLUME_ID_LOGGING_H_
-#define _VOLUME_ID_LOGGING_H_
-
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE 1
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/* just use the udev version */
-#include "../../../logging.h"
-
-#endif /* _VOLUME_ID_LOGGING_H_ */
diff --git a/extras/volume_id/libvolume_id/lsi_raid.c b/extras/volume_id/libvolume_id/lsi_raid.c
index 4e6c095b86..f1db4a6e50 100644
--- a/extras/volume_id/libvolume_id/lsi_raid.c
+++ b/extras/volume_id/libvolume_id/lsi_raid.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct lsi_meta {
diff --git a/extras/volume_id/libvolume_id/luks.c b/extras/volume_id/libvolume_id/luks.c
index 5346450ecc..64de85ac21 100644
--- a/extras/volume_id/libvolume_id/luks.c
+++ b/extras/volume_id/libvolume_id/luks.c
@@ -25,7 +25,6 @@
#include "libvolume_id.h"
#include "util.h"
-#include "logging.h"
#define SECTOR_SHIFT 9
#define SECTOR_SIZE (1 << SECTOR_SHIFT)
diff --git a/extras/volume_id/libvolume_id/lvm.c b/extras/volume_id/libvolume_id/lvm.c
index 4a1620e8a4..47d84b0968 100644
--- a/extras/volume_id/libvolume_id/lvm.c
+++ b/extras/volume_id/libvolume_id/lvm.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct lvm1_super_block {
diff --git a/extras/volume_id/libvolume_id/minix.c b/extras/volume_id/libvolume_id/minix.c
index 957925fe1f..75e9c3acbd 100644
--- a/extras/volume_id/libvolume_id/minix.c
+++ b/extras/volume_id/libvolume_id/minix.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct minix_super_block
diff --git a/extras/volume_id/libvolume_id/ntfs.c b/extras/volume_id/libvolume_id/ntfs.c
index a46359268e..23c64fc307 100644
--- a/extras/volume_id/libvolume_id/ntfs.c
+++ b/extras/volume_id/libvolume_id/ntfs.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct ntfs_super_block {
diff --git a/extras/volume_id/libvolume_id/nvidia_raid.c b/extras/volume_id/libvolume_id/nvidia_raid.c
index 7e1b58ba55..10c1c714f7 100644
--- a/extras/volume_id/libvolume_id/nvidia_raid.c
+++ b/extras/volume_id/libvolume_id/nvidia_raid.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct nvidia_meta {
diff --git a/extras/volume_id/libvolume_id/ocfs.c b/extras/volume_id/libvolume_id/ocfs.c
index c55b7234f4..b376ead833 100644
--- a/extras/volume_id/libvolume_id/ocfs.c
+++ b/extras/volume_id/libvolume_id/ocfs.c
@@ -25,7 +25,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
diff --git a/extras/volume_id/libvolume_id/promise_raid.c b/extras/volume_id/libvolume_id/promise_raid.c
index f58dab28e9..2a2ce1689e 100644
--- a/extras/volume_id/libvolume_id/promise_raid.c
+++ b/extras/volume_id/libvolume_id/promise_raid.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct promise_meta {
diff --git a/extras/volume_id/libvolume_id/reiserfs.c b/extras/volume_id/libvolume_id/reiserfs.c
index 5a9d71b53d..b5706f86e0 100644
--- a/extras/volume_id/libvolume_id/reiserfs.c
+++ b/extras/volume_id/libvolume_id/reiserfs.c
@@ -25,7 +25,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct reiserfs_super_block {
diff --git a/extras/volume_id/libvolume_id/romfs.c b/extras/volume_id/libvolume_id/romfs.c
index 171bb5a2a0..8bb2a0018a 100644
--- a/extras/volume_id/libvolume_id/romfs.c
+++ b/extras/volume_id/libvolume_id/romfs.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct romfs_super {
diff --git a/extras/volume_id/libvolume_id/silicon_raid.c b/extras/volume_id/libvolume_id/silicon_raid.c
index e9ce4e0b78..017b023e27 100644
--- a/extras/volume_id/libvolume_id/silicon_raid.c
+++ b/extras/volume_id/libvolume_id/silicon_raid.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct silicon_meta {
diff --git a/extras/volume_id/libvolume_id/squashfs.c b/extras/volume_id/libvolume_id/squashfs.c
index 3eabce71ae..bdb1f16628 100644
--- a/extras/volume_id/libvolume_id/squashfs.c
+++ b/extras/volume_id/libvolume_id/squashfs.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
#define SQUASHFS_MAGIC 0x73717368
diff --git a/extras/volume_id/libvolume_id/sysv.c b/extras/volume_id/libvolume_id/sysv.c
index 41a32bbaa2..52349c0623 100644
--- a/extras/volume_id/libvolume_id/sysv.c
+++ b/extras/volume_id/libvolume_id/sysv.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
#define SYSV_NICINOD 100
diff --git a/extras/volume_id/libvolume_id/udf.c b/extras/volume_id/libvolume_id/udf.c
index 54e66b4e86..d7497ec51b 100644
--- a/extras/volume_id/libvolume_id/udf.c
+++ b/extras/volume_id/libvolume_id/udf.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct volume_descriptor {
diff --git a/extras/volume_id/libvolume_id/ufs.c b/extras/volume_id/libvolume_id/ufs.c
index be6fa9e9ea..d3960b1bec 100644
--- a/extras/volume_id/libvolume_id/ufs.c
+++ b/extras/volume_id/libvolume_id/ufs.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct ufs_super_block {
diff --git a/extras/volume_id/libvolume_id/util.c b/extras/volume_id/libvolume_id/util.c
index b49dd6dd14..cf5392cf9a 100644
--- a/extras/volume_id/libvolume_id/util.c
+++ b/extras/volume_id/libvolume_id/util.c
@@ -26,7 +26,6 @@
#include <sys/stat.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
void volume_id_set_unicode16(char *str, size_t len, const uint8_t *buf, enum endian endianess, size_t count)
diff --git a/extras/volume_id/libvolume_id/util.h b/extras/volume_id/libvolume_id/util.h
index 8cb1abd360..1d1b53bb57 100644
--- a/extras/volume_id/libvolume_id/util.h
+++ b/extras/volume_id/libvolume_id/util.h
@@ -1,7 +1,7 @@
/*
* volume_id - reads filesystem label and uuid
*
- * Copyright (C) 2005 Kay Sievers <kay.sievers@vrfy.org>
+ * Copyright (C) 2005-2006 Kay Sievers <kay.sievers@vrfy.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -21,6 +21,15 @@
#include <endian.h>
#include <byteswap.h>
+#include <syslog.h>
+
+#define err(format, arg...) volume_id_log(LOG_ERR, __FILE__, __LINE__, format, ##arg)
+#define info(format, arg...) volume_id_log(LOG_INFO, __FILE__, __LINE__, format, ##arg)
+#ifdef DEBUG
+#define dbg(format, arg...) volume_id_log(LOG_DEBUG, __FILE__, __LINE__, format, ##arg)
+#else
+#define dbg(format, arg...) do { } while (0)
+#endif
/* size of superblock buffer, reiserfs block is at 64k */
#define SB_BUFFER_SIZE 0x11000
diff --git a/extras/volume_id/libvolume_id/via_raid.c b/extras/volume_id/libvolume_id/via_raid.c
index e70cfa1241..42cb098065 100644
--- a/extras/volume_id/libvolume_id/via_raid.c
+++ b/extras/volume_id/libvolume_id/via_raid.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct via_meta {
diff --git a/extras/volume_id/libvolume_id/volume_id.c b/extras/volume_id/libvolume_id/volume_id.c
index e5f0d90ee8..073ad79c77 100644
--- a/extras/volume_id/libvolume_id/volume_id.c
+++ b/extras/volume_id/libvolume_id/volume_id.c
@@ -27,9 +27,15 @@
#include <sys/stat.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
+/* the user can overwrite this log function */
+static void default_log(int priority, const char *file, int line, const char *format, ...)
+{
+ return;
+}
+
+volume_id_log_fn volume_id_log = default_log;
int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size)
{
diff --git a/extras/volume_id/libvolume_id/vxfs.c b/extras/volume_id/libvolume_id/vxfs.c
index 406391bf0e..d10cc37762 100644
--- a/extras/volume_id/libvolume_id/vxfs.c
+++ b/extras/volume_id/libvolume_id/vxfs.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
#define VXFS_SUPER_MAGIC 0xa501FCF5
diff --git a/extras/volume_id/libvolume_id/xfs.c b/extras/volume_id/libvolume_id/xfs.c
index 4b48ff1250..3d870c41e7 100644
--- a/extras/volume_id/libvolume_id/xfs.c
+++ b/extras/volume_id/libvolume_id/xfs.c
@@ -24,7 +24,6 @@
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct xfs_super_block {
diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c
index 518962c10b..b086b3710c 100644
--- a/extras/volume_id/vol_id.c
+++ b/extras/volume_id/vol_id.c
@@ -60,6 +60,18 @@ void log_message(int priority, const char *format, ...)
}
#endif
+static void vid_log(int priority, const char *file, int line, const char *format, ...)
+{
+#ifdef USE_LOG
+ va_list args;
+
+ va_start(args, format);
+ log_message(priority, format, args);
+ va_end(args);
+#endif
+ return;
+}
+
static void set_str(char *to, const char *from, size_t count)
{
size_t i, j, len;
@@ -117,6 +129,9 @@ int main(int argc, char *argv[])
logging_init("vol_id");
+ /* hook in our debug into libvolume_id */
+ volume_id_log = vid_log;
+
for (i = 1 ; i < argc; i++) {
char *arg = argv[i];