]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfsprogs: metadump: encapsulate the nametable code
authorAlex Elder <aelder@sgi.com>
Fri, 18 Feb 2011 21:21:01 +0000 (21:21 +0000)
committerAlex Elder <aelder@sgi.com>
Tue, 8 Mar 2011 18:04:33 +0000 (12:04 -0600)
commita85f8b0aac507d02fd4e104c576eaa6d1aefcb33
tree16fb13b094451baa8b9876a814da1ca7bf6c5237
parent88b1fe2aa7fded8f5036ec32cba6f576503aa235
xfsprogs: metadump: encapsulate the nametable code

The name table used to find duplicates in metadump.c is allocated
dynamically, but there's no real need to do so.  Just make it a BSS
global array and drop the initialization call.

Meanwhile, encapsulate the code that adds entries to and looks up
entries in the table into their own functions.  Use the lookup
function to detect a duplicate name in a case not previously
checked.

Change the naming scheme to use "nametable" as a prefix rather than
a suffix.

Finally, now that it's easy to do so, issue a warning if we find
that we're falling back to not obfuscating the name, but that name
has already been used in the current directory.  (This can happen if
a obfuscated earlier happens to match a subsequently found "real"
name.)

Signed-off-by: Alex Elder <aelder@sgi.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
db/metadump.c