mirror of
https://github.com/AuxXxilium/eudev.git
synced 2025-02-10 19:15:56 +07:00
volume_id: provide a custom debug function
This commit is contained in:
parent
727f3fb091
commit
b5e6942671
@ -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)
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct cramfs_super {
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "util.h"
|
||||
#include "logging.h"
|
||||
|
||||
struct ext2_super_block {
|
||||
uint32_t s_inodes_count;
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
#define FAT12_MAX 0xff5
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct hfs_finder_info{
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct hpt37x_meta {
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct hpfs_super
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
#define ISO_SUPERBLOCK_OFFSET 0x8000
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct isw_meta {
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct jfs_super_block {
|
||||
|
@ -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
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct mdp_super_block {
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct swap_header_v1_2 {
|
||||
|
@ -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_ */
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct lsi_meta {
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "util.h"
|
||||
#include "logging.h"
|
||||
|
||||
#define SECTOR_SHIFT 9
|
||||
#define SECTOR_SIZE (1 << SECTOR_SHIFT)
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct lvm1_super_block {
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct minix_super_block
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct ntfs_super_block {
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct nvidia_meta {
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct promise_meta {
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct reiserfs_super_block {
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct romfs_super {
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct silicon_meta {
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
#define SQUASHFS_MAGIC 0x73717368
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
#define SYSV_NICINOD 100
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct volume_descriptor {
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct ufs_super_block {
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct via_meta {
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
#define VXFS_SUPER_MAGIC 0xa501FCF5
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "libvolume_id.h"
|
||||
#include "logging.h"
|
||||
#include "util.h"
|
||||
|
||||
struct xfs_super_block {
|
||||
|
@ -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];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user