diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2017-12-06 09:17:08 -0600 |
---|---|---|
committer | Eric Sandeen <sandeen@redhat.com> | 2017-12-06 09:17:08 -0600 |
commit | 852fe0131d1647bb89cf6d894348091d8a8c68be (patch) | |
tree | 9f5db221adbbb4f3f02c8047c5977a0a70609987 | |
parent | ce1abf95b49120035a077107b39f23d15d82fa7b (diff) | |
download | xfsprogs-dev-852fe0131d1647bb89cf6d894348091d8a8c68be.tar.gz |
libhandle: add missing destructor
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>
-rw-r--r-- | include/handle.h | 2 | ||||
-rw-r--r-- | libhandle/handle.c | 13 |
2 files changed, 15 insertions, 0 deletions
diff --git a/include/handle.h b/include/handle.h index ee69a11dac..49f14410ca 100644 --- a/include/handle.h +++ b/include/handle.h @@ -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 diff --git a/libhandle/handle.c b/libhandle/handle.c index 00127b3c36..e6971dd306 100644 --- a/libhandle/handle.c +++ b/libhandle/handle.c @@ -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 */ |