chiark / gitweb /
vol_id: fix logging from libvolume_id's log function
authorKay Sievers <kay.sievers@suse.de>
Fri, 28 Apr 2006 15:52:09 +0000 (17:52 +0200)
committerKay Sievers <kay.sievers@suse.de>
Fri, 28 Apr 2006 15:52:09 +0000 (17:52 +0200)
extras/volume_id/lib/volume_id.c
extras/volume_id/vol_id.c
udev_rules.c

index 9f8e39b51814f28928b2db02ac110b07c0b4c51a..33fd890dfd61fdedba1369d2c46625a2e59419dd 100644 (file)
@@ -21,7 +21,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
-#include <errno.h>
 #include <ctype.h>
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <ctype.h>
 #include <fcntl.h>
 #include <sys/stat.h>
@@ -42,6 +41,9 @@ int volume_id_probe_raid(struct volume_id *id, uint64_t off, uint64_t size)
        if (id == NULL)
                return -EINVAL;
 
        if (id == NULL)
                return -EINVAL;
 
+       info("probing at offset 0x%llx, size 0x%llx",
+           (unsigned long long) off, (unsigned long long) size);
+
        /* probe for raid first, because fs probes may be successful on raid members */
        if (size) {
                if (volume_id_probe_linux_raid(id, off, size) == 0)
        /* probe for raid first, because fs probes may be successful on raid members */
        if (size) {
                if (volume_id_probe_linux_raid(id, off, size) == 0)
@@ -91,6 +93,9 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size
        if (id == NULL)
                return -EINVAL;
 
        if (id == NULL)
                return -EINVAL;
 
+       info("probing at offset 0x%llx, size 0x%llx",
+           (unsigned long long) off, (unsigned long long) size);
+
        if (volume_id_probe_luks(id, off) == 0)
                goto found;
 
        if (volume_id_probe_luks(id, off) == 0)
                goto found;
 
index 2274550c197305e9d15d573a87ba65b4f7426bf2..dcf56d87e9fb4562c1fe3f54de8075232637795c 100644 (file)
@@ -63,10 +63,13 @@ void log_message(int priority, const char *format, ...)
 static void vid_log(int priority, const char *file, int line, const char *format, ...)
 {
 #ifdef USE_LOG
 static void vid_log(int priority, const char *file, int line, const char *format, ...)
 {
 #ifdef USE_LOG
+       char log_str[1024];
        va_list args;
 
        va_start(args, format);
        va_list args;
 
        va_start(args, format);
-       log_message(priority, format, args);
+       vsnprintf(log_str, sizeof(log_str), format, args);
+       log_str[sizeof(log_str)-1] = '\0';
+       log_message(priority, "%s:%i %s", file, line, log_str);
        va_end(args);
 #endif
        return;
        va_end(args);
 #endif
        return;
index 596bcd188bc28064d49330bb3248b9b036d00948..ee4632513acd317a6f1d3e357005311d8864f2bf 100644 (file)
@@ -2,17 +2,17 @@
  * udev_rules.c
  *
  * Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
  * udev_rules.c
  *
  * Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
- * Copyright (C) 2003-2005 Kay Sievers <kay.sievers@vrfy.org>
+ * Copyright (C) 2003-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
  *     Free Software Foundation version 2 of the License.
  *
  *     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.
- * 
+ *
  *     This program 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.
  *     This program 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.
- * 
+ *
  *     You should have received a copy of the GNU General Public License along
  *     with this program; if not, write to the Free Software Foundation, Inc.,
  *     675 Mass Ave, Cambridge, MA 02139, USA.
  *     You should have received a copy of the GNU General Public License along
  *     with this program; if not, write to the Free Software Foundation, Inc.,
  *     675 Mass Ave, Cambridge, MA 02139, USA.
@@ -451,8 +451,7 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize)
                                                goto found;
                                        }
                                }
                                                goto found;
                                        }
                                }
-                       }
-                       else if (head[0] == '%') {
+                       } else if (head[0] == '%') {
                                /* substitute format char */
                                if (head[1] == '\0')
                                        break;
                                /* substitute format char */
                                if (head[1] == '\0')
                                        break;