]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libhandle: add missing destructor
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 6 Dec 2017 15:17:08 +0000 (09:17 -0600)
committerEric Sandeen <sandeen@redhat.com>
Wed, 6 Dec 2017 15:17:08 +0000 (09:17 -0600)
Make it so that we can tear down the file descriptor hash table.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
include/handle.h
libhandle/handle.c

index ee69a11dacca74be25874b88ba599f33c0b845b3..49f14410ca2135ee14f82ef3eead084d9badf257 100644 (file)
@@ -50,6 +50,8 @@ extern int  parentpaths_by_handle(void *__hanp, size_t __hlen,
 extern int  fssetdm_by_handle (void *__hanp, size_t __hlen,
                               struct fsdmidata *__fsdmi);
 
+void fshandle_destroy(void);
+
 #ifdef __cplusplus
 }
 #endif
index 00127b3c365ef8136ab260775234c30d02682b88..e6971dd3062a8d383b4ac08ae108029ae55bcc9e 100644 (file)
@@ -62,6 +62,19 @@ struct fdhash {
 
 static struct fdhash *fdhash_head = NULL;
 
+void
+fshandle_destroy(void)
+{
+       struct fdhash   *nexth;
+       struct fdhash   *h = fdhash_head;
+
+       while (h) {
+               nexth = h->fnxt;
+               free(h);
+               h = nexth;
+       }
+}
+
 int
 path_to_fshandle(
        char            *path,          /* input,  path to convert */