]> www.infradead.org Git - mtd-utils.git/commitdiff
fs-tests: integck: clean up add_dir_entry usage
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Mon, 18 Apr 2011 14:47:29 +0000 (17:47 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Fri, 22 Apr 2011 11:29:53 +0000 (14:29 +0300)
Make 'add_dir_entry()' consistent and allocate name for all types,
not only for 'd' and 's'. Also, since 'add_dir_entry()' sets the
parent - do not do this in the calling functions.

This is a clean-up which makes 'add_dir_entry()' more consistent.

Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
tests/fs-tests/integrity/integck.c

index 94ffeb8008f585dec7f3a1db68e9756ae5d4e1ee..03b3a01424810baf73afe8b4bf1efe7b78d55575 100644 (file)
@@ -399,6 +399,7 @@ static void add_dir_entry(struct dir_info *parent, char type, const char *name,
        if (entry->type == 'f') {
                struct file_info *file = target;
 
+               file->name = dup_string(name);
                entry->file = file;
                entry->next_link = file->links;
                if (file->links)
@@ -472,7 +473,6 @@ static int dir_new(struct dir_info *parent, const char *name)
        free(path);
 
        dir = zalloc(sizeof(struct dir_info));
-       dir->parent = parent;
        if (parent)
                add_dir_entry(parent, 'd', name, dir);
        return 0;
@@ -545,8 +545,6 @@ static int file_new(struct dir_info *parent, const char *name)
        free(path);
 
        file = zalloc(sizeof(struct file_info));
-       file->name = dup_string(name);
-
        add_dir_entry(parent, 'f', name, file);
        add_fd(file, fd);
        return 0;