From f0e5e980a2e7902d55ecac52a2fdbb1832c36478 Mon Sep 17 00:00:00 2001 From: Phillip Lougher Date: Sun, 20 Apr 2014 23:47:08 +0100 Subject: pseudo: fix pseudo definition dumping and actually call it Signed-off-by: Phillip Lougher --- squashfs-tools/pseudo.c | 58 +++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 26 deletions(-) (limited to 'squashfs-tools/pseudo.c') diff --git a/squashfs-tools/pseudo.c b/squashfs-tools/pseudo.c index c219789..10c0b6a 100644 --- a/squashfs-tools/pseudo.c +++ b/squashfs-tools/pseudo.c @@ -47,32 +47,6 @@ struct pseudo_dev **pseudo_file = NULL; struct pseudo *pseudo = NULL; int pseudo_count = 0; -static void dump_pseudo(struct pseudo *pseudo, char *string) -{ - int i, res; - char *path; - - for(i = 0; i < pseudo->names; i++) { - struct pseudo_entry *entry = &pseudo->name[i]; - if(string) { - res = asprintf(&path, "%s/%s", string, entry->name); - if(res == -1) - BAD_ERROR("asprintf failed in dump_pseudo\n"); - } else - path = entry->name; - if(entry->pseudo == NULL) - ERROR("%s %c %o %d %d %d %d\n", path, entry->dev->type, - entry->dev->mode, entry->dev->uid, - entry->dev->gid, entry->dev->major, - entry->dev->minor); - else - dump_pseudo(entry->pseudo, path); - if(string) - free(path); - } -} - - static char *get_component(char *target, char **targname) { char *start; @@ -571,3 +545,35 @@ struct pseudo *get_pseudo() { return pseudo; } + + +static void dump_pseudo(struct pseudo *pseudo, char *string) +{ + int i, res; + char *path; + + for(i = 0; i < pseudo->names; i++) { + struct pseudo_entry *entry = &pseudo->name[i]; + if(string) { + res = asprintf(&path, "%s/%s", string, entry->name); + if(res == -1) + BAD_ERROR("asprintf failed in dump_pseudo\n"); + } else + path = entry->name; + if(entry->dev) + ERROR("%s %c 0%o %d %d %d %d\n", path, entry->dev->type, + entry->dev->mode & ~S_IFMT, entry->dev->uid, + entry->dev->gid, entry->dev->major, + entry->dev->minor); + if(entry->pseudo) + dump_pseudo(entry->pseudo, path); + if(string) + free(path); + } +} + + +void dump_pseudos() +{ + dump_pseudo(pseudo, NULL); +} -- cgit v1.2.3