Skip to content

Instantly share code, notes, and snippets.

@hnyman
Created February 20, 2017 21:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hnyman/a7321091e33b5068b8720cbd749acbe4 to your computer and use it in GitHub Desktop.
Save hnyman/a7321091e33b5068b8720cbd749acbe4 to your computer and use it in GitHub Desktop.
--- a/block.c
+++ b/block.c
@@ -855,12 +855,16 @@ static int handle_mount(const char *sour
size_t mount_opts_len;
char *mount_opts = NULL, *ptr;
+ ULOG_ERR("handle_mount mount source=%s, target=%s, fstype=%s\n",
+ source, target, fstype);
err = mount(source, target, fstype, m ? m->flags : 0,
(m && m->options) ? m->options : "");
+ ULOG_ERR("handle_mount first mount cmd over\n");
/* Requested file system type is not available in kernel,
attempt to call mount helper. */
if (err == -1 && errno == ENODEV) {
+ ULOG_ERR("handle_mount parse mount options\n");
if (m) {
/* Convert mount flags back into string representation,
first calculate needed length of string buffer... */
@@ -871,6 +875,7 @@ static int handle_mount(const char *sour
(mount_flags[i].flag < INT_MAX) &&
(m->flags & (uint32_t)mount_flags[i].flag))
mount_opts_len += strlen(mount_flags[i].name) + 1;
+ ULOG_ERR("handle_mount mount flags size calc over\n");
/* ... then now allocate and fill it ... */
ptr = mount_opts = calloc(1, mount_opts_len);
@@ -888,10 +893,12 @@ static int handle_mount(const char *sour
(mount_flags[i].flag < INT_MAX) &&
(m->flags & (uint32_t)mount_flags[i].flag))
ptr += sprintf(ptr, "%s,", mount_flags[i].name);
+ ULOG_ERR("handle_mount parse mount flags over\n");
mount_opts[mount_opts_len - 1] = 0;
}
+ ULOG_ERR("handle_mount call exec_mount\n");
/* ... and now finally invoke the external mount program */
err = exec_mount(source, target, fstype, mount_opts);
}
@@ -909,6 +916,8 @@ static int mount_device(struct probe_inf
return -1;
device = basename(pr->dev);
+ ULOG_ERR("mount_device for %s, type=%s, version=%s,\n label=%s, uuid=%s\n",
+ device, pr->type, pr->version, pr->label, pr->uuid);
if (!strcmp(pr->type, "swap")) {
if (hotplug && !auto_swap)
@@ -923,13 +932,15 @@ static int mount_device(struct probe_inf
if (hotplug && !auto_mount)
return -1;
+ ULOG_ERR("mount_device for %s auto_mount test\n", device);
mp = find_mount_point(pr->dev);
if (mp) {
- ULOG_ERR("%s is already mounted on %s\n", pr->dev, mp);
+ ULOG_ERR("%s is already mounted on %s\n\n", pr->dev, mp);
free(mp);
return -1;
}
+ ULOG_ERR("mount_device for %s extroot test\n", device);
m = find_block(pr->uuid, pr->label, device, NULL);
if (m && m->extroot)
return -1;
@@ -957,6 +968,7 @@ static int mount_device(struct probe_inf
return err;
}
+ ULOG_ERR("mount_device for %s check anon_mount\n", device);
if (anon_mount) {
char target[32];
int err = 0;
@@ -967,6 +979,7 @@ static int mount_device(struct probe_inf
if (check_fs)
check_filesystem(pr);
+ ULOG_ERR("mount_device for %s try anon_mount\n", device);
err = handle_mount(pr->dev, target, pr->type, NULL);
if (err)
ULOG_ERR("mounting %s (%s) as %s failed (%d) - %s\n",
@@ -976,6 +989,7 @@ static int mount_device(struct probe_inf
return err;
}
+ ULOG_ERR("mount_device for %s ends\n", device);
return 0;
}
@@ -1423,9 +1437,11 @@ static int main_mount(int argc, char **a
return -1;
cache_load(1);
+ ULOG_ERR("list_for_each_entry starts\n");
list_for_each_entry(pr, &devices, list)
mount_device(pr, 0);
+ ULOG_ERR("list_for_each_entry ends\n");
handle_swapfiles(true);
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment