]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: minor fix to mnt_tabdiff_*
authorKarel Zak <kzak@redhat.com>
Wed, 27 Apr 2011 15:17:16 +0000 (17:17 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 27 Apr 2011 15:17:16 +0000 (17:17 +0200)
 - tabdiff has to support NULL fs->source
 - disable some debug messages

Signed-off-by: Karel Zak <kzak@redhat.com>
shlibs/mount/src/cache.c
shlibs/mount/src/tab.c
shlibs/mount/src/tab_diff.c
shlibs/mount/src/tab_parse.c

index 18b6cd49afa9feb524a908e19c97d97271738b45..4775069c014a9d010737eed70bc62629d077c74c 100644 (file)
@@ -446,7 +446,7 @@ char *mnt_resolve_path(const char *path, struct libmnt_cache *cache)
 
        assert(path);
 
-       DBG(CACHE, mnt_debug_h(cache, "resolving path %s", path));
+       /*DBG(CACHE, mnt_debug_h(cache, "resolving path %s", path));*/
 
        if (!path)
                return NULL;
@@ -494,8 +494,8 @@ char *mnt_resolve_tag(const char *token, const char *value,
        assert(token);
        assert(value);
 
-       DBG(CACHE, mnt_debug_h(cache, "resolving tag token=%s value=%s",
-                               token, value));
+       /*DBG(CACHE, mnt_debug_h(cache, "resolving tag token=%s value=%s",
+                               token, value));*/
 
        if (!token || !value)
                return NULL;
index 5c3c7994b39d70cbe37c7ab78b4ed3b16be46f1c..2a6a2355ce31d0ebb739919a34fb63b9cf57a4b5 100644 (file)
@@ -102,6 +102,7 @@ int mnt_reset_table(struct libmnt_table *tb)
                mnt_free_fs(fs);
        }
 
+       tb->nents = 0;
        return 0;
 }
 
index 12b2f774256411c01159059109fe89cab446c6b1..d1a17bcb967556d3df7e3bd7308c46b7f23414d8 100644 (file)
@@ -190,7 +190,6 @@ static struct tabdiff_entry *tabdiff_get_mount(struct libmnt_tabdiff *df,
        struct list_head *p;
 
        assert(df);
-       assert(src);
 
        list_for_each(p, &df->changes) {
                struct tabdiff_entry *de;
@@ -202,7 +201,9 @@ static struct tabdiff_entry *tabdiff_get_mount(struct libmnt_tabdiff *df,
 
                        const char *s = mnt_fs_get_source(de->new_fs);
 
-                       if (s && strcmp(s, src) == 0)
+                       if (s == NULL && src == NULL)
+                               return de;
+                       if (s && src && strcmp(s, src) == 0)
                                return de;
                }
        }
index be85d4711510a40edf9eda9ebe65607b23ea9073..7419f37428b8cb539cb57b818433792836bcb6e9 100644 (file)
@@ -360,7 +360,8 @@ int mnt_table_parse_stream(struct libmnt_table *tb, FILE *f, const char *filenam
        assert(f);
        assert(filename);
 
-       DBG(TAB, mnt_debug_h(tb, "%s: start parsing", filename));
+       DBG(TAB, mnt_debug_h(tb, "%s: start parsing (%d entries)",
+                               filename, mnt_table_get_nents(tb)));
 
        /* necessary for /proc/mounts only, the /proc/self/mountinfo
         * parser sets the flag properly
@@ -389,7 +390,8 @@ int mnt_table_parse_stream(struct libmnt_table *tb, FILE *f, const char *filenam
                }
        }
 
-       DBG(TAB, mnt_debug_h(tb, "%s: stop parsing", filename));
+       DBG(TAB, mnt_debug_h(tb, "%s: stop parsing (%d entries)",
+                               filename, mnt_table_get_nents(tb)));
        return 0;
 err:
        DBG(TAB, mnt_debug_h(tb, "%s: parse error (rc=%d)", filename, rc));