From: Chuck Lever <chuck.lever@oracle.com>
To: steved@redhat.com
Cc: linux-nfs@vger.kernel.org
Subject: [PATCH 1/2] libexport.a: Add export_free()
Date: Thu, 15 Apr 2010 11:25:15 -0400 [thread overview]
Message-ID: <20100415152514.4716.41039.stgit@localhost.localdomain> (raw)
In-Reply-To: <20100415152401.4716.83632.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
Clean up: Introduce a helper to free an nfs_export record.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
support/export/export.c | 27 +++++++++++++++++----------
1 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/support/export/export.c b/support/export/export.c
index 42e78f6..ddc8a84 100644
--- a/support/export/export.c
+++ b/support/export/export.c
@@ -28,6 +28,18 @@ static int export_check(nfs_export *, struct hostent *, char *);
static nfs_export *
export_allowed_internal(struct hostent *hp, char *path);
+static void
+export_free(nfs_export *exp)
+{
+ xfree(exp->m_export.e_squids);
+ xfree(exp->m_export.e_sqgids);
+ free(exp->m_export.e_mountpoint);
+ free(exp->m_export.e_fslocdata);
+
+ xfree(exp->m_export.e_hostname);
+ xfree(exp);
+}
+
static void warn_duplicated_exports(nfs_export *exp, struct exportent *eep)
{
if (exp->m_export.e_flags != eep->e_flags) {
@@ -260,6 +272,10 @@ export_check(nfs_export *exp, struct hostent *hp, char *path)
return client_check(exp->m_client, hp);
}
+/**
+ * export_freeall - deallocate all nfs_export records
+ *
+ */
void
export_freeall(void)
{
@@ -270,16 +286,7 @@ export_freeall(void)
for (exp = exportlist[i].p_head; exp; exp = nxt) {
nxt = exp->m_next;
client_release(exp->m_client);
- if (exp->m_export.e_squids)
- xfree(exp->m_export.e_squids);
- if (exp->m_export.e_sqgids)
- xfree(exp->m_export.e_sqgids);
- if (exp->m_export.e_mountpoint)
- free(exp->m_export.e_mountpoint);
- if (exp->m_export.e_fslocdata)
- free(exp->m_export.e_fslocdata);
- xfree(exp->m_export.e_hostname);
- xfree(exp);
+ export_free(exp);
}
for (j = 0; j < HASH_TABLE_SIZE; j++) {
exportlist[i].entries[j].p_first = NULL;
next prev parent reply other threads:[~2010-04-15 15:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-15 15:25 [PATCH 0/2] Handle address parsing errors in export_find() Chuck Lever
[not found] ` <20100415152401.4716.83632.stgit-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-04-15 15:25 ` Chuck Lever [this message]
2010-04-15 15:25 ` [PATCH 2/2] libexport.a: export_find() should handle address parsing errors Chuck Lever
2010-04-16 17:05 ` [PATCH 0/2] Handle address parsing errors in export_find() Steve Dickson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100415152514.4716.41039.stgit@localhost.localdomain \
--to=chuck.lever@oracle.com \
--cc=linux-nfs@vger.kernel.org \
--cc=steved@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox