[PATCH 11/12] libhandle: add missing destructor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

Make it so that we can tear down the file descriptor hash table.

Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
---
 include/handle.h   |    2 ++
 libhandle/handle.c |   13 +++++++++++++
 2 files changed, 15 insertions(+)


diff --git a/include/handle.h b/include/handle.h
index ee69a11..49f1441 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 00127b3..e6971dd 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 */

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux