chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gpt-auto-generator: include device name in error reports
[elogind.git]
/
src
/
gpt-auto-generator
/
gpt-auto-generator.c
diff --git
a/src/gpt-auto-generator/gpt-auto-generator.c
b/src/gpt-auto-generator/gpt-auto-generator.c
index 60fb19ee07f4f2394a076a4f5b4aee352f3e86c9..60cbd7ee25ed0108295fa9f0d4671f7ab0250611 100644
(file)
--- a/
src/gpt-auto-generator/gpt-auto-generator.c
+++ b/
src/gpt-auto-generator/gpt-auto-generator.c
@@
-22,11
+22,14
@@
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
-#include <linux/btrfs.h>
#include <sys/ioctl.h>
#include <sys/statfs.h>
#include <blkid.h>
#include <sys/ioctl.h>
#include <sys/statfs.h>
#include <blkid.h>
+#ifdef HAVE_LINUX_BTRFS_H
+#include <linux/btrfs.h>
+#endif
+
#include "path-util.h"
#include "util.h"
#include "mkdir.h"
#include "path-util.h"
#include "util.h"
#include "mkdir.h"
@@
-175,7
+178,7
@@
static int add_swap(const char *path, const char *fstype) {
"DefaultDependencies=no\n"
"Conflicts=" SPECIAL_UMOUNT_TARGET "\n"
"Before=" SPECIAL_UMOUNT_TARGET " " SPECIAL_SWAP_TARGET "\n\n"
"DefaultDependencies=no\n"
"Conflicts=" SPECIAL_UMOUNT_TARGET "\n"
"Before=" SPECIAL_UMOUNT_TARGET " " SPECIAL_SWAP_TARGET "\n\n"
- "[
Mount
]\n"
+ "[
Swap
]\n"
"What=%s\n",
path);
"What=%s\n",
path);
@@
-296,7
+299,8
@@
static int enumerate_partitions(dev_t dev) {
r = udev_enumerate_scan_devices(e);
if (r < 0) {
r = udev_enumerate_scan_devices(e);
if (r < 0) {
- log_error("Failed to enumerate partitions: %s", strerror(-r));
+ log_error("Failed to enumerate partitions on /dev/block/%u:%u: %s",
+ major(dev), minor(dev), strerror(-r));
goto finish;
}
goto finish;
}
@@
-307,6
+311,7
@@
static int enumerate_partitions(dev_t dev) {
struct udev_device *q;
sd_id128_t type_id;
unsigned nr;
struct udev_device *q;
sd_id128_t type_id;
unsigned nr;
+ dev_t sub;
q = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item));
if (!q) {
q = udev_device_new_from_syspath(udev, udev_list_entry_get_name(item));
if (!q) {
@@
-326,9
+331,12
@@
static int enumerate_partitions(dev_t dev) {
goto finish;
}
goto finish;
}
- r = verify_gpt_partition(udev_device_get_devnum(q), &type_id, &nr, &fstype);
+ sub = udev_device_get_devnum(q);
+
+ r = verify_gpt_partition(sub, &type_id, &nr, &fstype);
if (r < 0) {
if (r < 0) {
- log_error("Failed to verify GPT partition: %s", strerror(-r));
+ log_error("Failed to verify GPT partition /dev/block/%u:%u: %s",
+ major(sub), minor(sub), strerror(-r));
udev_device_unref(q);
goto finish;
}
udev_device_unref(q);
goto finish;
}
@@
-480,11
+488,12
@@
int main(int argc, char *argv[]) {
return EXIT_SUCCESS;
}
return EXIT_SUCCESS;
}
- log_debug("Root device %u:%u.", major(dev), minor(dev));
+ log_debug("Root device
/dev/block/
%u:%u.", major(dev), minor(dev));
r = verify_gpt_partition(dev, NULL, NULL, NULL);
if (r < 0) {
r = verify_gpt_partition(dev, NULL, NULL, NULL);
if (r < 0) {
- log_error("Failed to verify GPT partition: %s", strerror(-r));
+ log_error("Failed to verify GPT partition /dev/block/%u:%u: %s",
+ major(dev), minor(dev), strerror(-r));
return EXIT_FAILURE;
}
if (r == 0)
return EXIT_FAILURE;
}
if (r == 0)