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)
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct cramfs_super {
#include "libvolume_id.h"
#include "util.h"
-#include "logging.h"
struct ext2_super_block {
uint32_t s_inodes_count;
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
#define FAT12_MAX 0xff5
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct hfs_finder_info{
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct hpt37x_meta {
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct hpfs_super
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
#define ISO_SUPERBLOCK_OFFSET 0x8000
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct isw_meta {
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct jfs_super_block {
#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
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct mdp_super_block {
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct swap_header_v1_2 {
+++ /dev/null
-/*
- * 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_ */
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct lsi_meta {
#include "libvolume_id.h"
#include "util.h"
-#include "logging.h"
#define SECTOR_SHIFT 9
#define SECTOR_SIZE (1 << SECTOR_SHIFT)
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct lvm1_super_block {
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct minix_super_block
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct ntfs_super_block {
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct nvidia_meta {
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct promise_meta {
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct reiserfs_super_block {
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct romfs_super {
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct silicon_meta {
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
#define SQUASHFS_MAGIC 0x73717368
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
#define SYSV_NICINOD 100
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct volume_descriptor {
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct ufs_super_block {
#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)
/*
* 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
#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
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct via_meta {
#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)
{
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
#define VXFS_SUPER_MAGIC 0xa501FCF5
#include <ctype.h>
#include "libvolume_id.h"
-#include "logging.h"
#include "util.h"
struct xfs_super_block {
}
#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;
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];