Blame SOURCES/autofs-5.1.7-rename-tree-implementation-functions.patch

49b67f
autofs-5.1.7 - rename tree implementation functions
49b67f
49b67f
From: Ian Kent <raven@themaw.net>
49b67f
49b67f
Rename the tree struct and functions to make them consistent.
49b67f
49b67f
Signed-off-by: Ian Kent <raven@themaw.net>
49b67f
---
49b67f
 CHANGELOG    |    1 
49b67f
 lib/mounts.c |   86 +++++++++++++++++++++++++++++------------------------------
49b67f
 2 files changed, 44 insertions(+), 43 deletions(-)
49b67f
49b67f
--- autofs-5.1.4.orig/CHANGELOG
49b67f
+++ autofs-5.1.4/CHANGELOG
49b67f
@@ -26,6 +26,7 @@
49b67f
 - cleanup cache_delete() a little.
49b67f
 - rename path to m_offset in update_offset_entry().
49b67f
 - don't pass root to do_mount_autofs_offset().
49b67f
+- rename tree implementation functions.
49b67f
 
49b67f
 xx/xx/2018 autofs-5.1.5
49b67f
 - fix flag file permission.
49b67f
--- autofs-5.1.4.orig/lib/mounts.c
49b67f
+++ autofs-5.1.4/lib/mounts.c
49b67f
@@ -1225,30 +1225,30 @@ done:
49b67f
 	return has_mounted_mounts;
49b67f
 }
49b67f
 
49b67f
-struct node {
49b67f
+struct tree_node {
49b67f
 	struct mnt_list *mnt;
49b67f
-	struct node *left;
49b67f
-	struct node *right;
49b67f
+	struct tree_node *left;
49b67f
+	struct tree_node *right;
49b67f
 };
49b67f
 
49b67f
-static struct node *new(struct mnt_list *mnt)
49b67f
+static struct tree_node *tree_new(struct mnt_list *mnt)
49b67f
 {
49b67f
-	struct node *n;
49b67f
+	struct tree_node *n;
49b67f
 
49b67f
-	n = malloc(sizeof(struct node));
49b67f
+	n = malloc(sizeof(struct tree_node));
49b67f
 	if (!n)
49b67f
 		return NULL;
49b67f
-	memset(n, 0, sizeof(struct node));
49b67f
+	memset(n, 0, sizeof(struct tree_node));
49b67f
 	n->mnt = mnt;
49b67f
 
49b67f
 	return n;
49b67f
 }
49b67f
 
49b67f
-static struct node *tree_root(struct mnt_list *mnt)
49b67f
+static struct tree_node *tree_root(struct mnt_list *mnt)
49b67f
 {
49b67f
-	struct node *n;
49b67f
+	struct tree_node *n;
49b67f
 
49b67f
-	n = new(mnt);
49b67f
+	n = tree_new(mnt);
49b67f
 	if (!n) {
49b67f
 		error(LOGOPT_ANY, "failed to allcate tree root");
49b67f
 		return NULL;
49b67f
@@ -1257,37 +1257,37 @@ static struct node *tree_root(struct mnt
49b67f
 	return n;
49b67f
 }
49b67f
 
49b67f
-static struct node *add_left(struct node *this, struct mnt_list *mnt)
49b67f
+static struct tree_node *tree_add_left(struct tree_node *n, struct mnt_list *mnt)
49b67f
 {
49b67f
-	struct node *n;
49b67f
+	struct tree_node *new;
49b67f
 
49b67f
-	n = new(mnt);
49b67f
-	if (!n) {
49b67f
+	new = tree_new(mnt);
49b67f
+	if (!new) {
49b67f
 		error(LOGOPT_ANY, "failed to allcate tree node");
49b67f
 		return NULL;
49b67f
 	}
49b67f
-	this->left = n;
49b67f
+	n->left = new;
49b67f
 
49b67f
 	return n;
49b67f
 }
49b67f
 
49b67f
-static struct node *add_right(struct node *this, struct mnt_list *mnt)
49b67f
+static struct tree_node *tree_add_right(struct tree_node *n, struct mnt_list *mnt)
49b67f
 {
49b67f
-	struct node *n;
49b67f
+	struct tree_node *new;
49b67f
 
49b67f
-	n = new(mnt);
49b67f
-	if (!n) {
49b67f
+	new = tree_new(mnt);
49b67f
+	if (!new) {
49b67f
 		error(LOGOPT_ANY, "failed to allcate tree node");
49b67f
 		return NULL;
49b67f
 	}
49b67f
-	this->right = n;
49b67f
+	n->right = new;
49b67f
 
49b67f
 	return n;
49b67f
 }
49b67f
 
49b67f
-static struct node *add_node(struct node *root, struct mnt_list *mnt)
49b67f
+static struct tree_node *tree_add_node(struct tree_node *root, struct mnt_list *mnt)
49b67f
 {
49b67f
-	struct node *p, *q;
49b67f
+	struct tree_node *p, *q;
49b67f
 	unsigned int mp_len;
49b67f
 
49b67f
 	mp_len = strlen(mnt->mp);
49b67f
@@ -1307,43 +1307,43 @@ static struct node *add_node(struct node
49b67f
 		error(LOGOPT_ANY, "duplicate entry in mounts list");
49b67f
 	else {
49b67f
 		if (mp_len < strlen(p->mnt->mp))
49b67f
-			return add_left(p, mnt);
49b67f
+			return tree_add_left(p, mnt);
49b67f
 		else
49b67f
-			return add_right(p, mnt);
49b67f
+			return tree_add_right(p, mnt);
49b67f
 	}
49b67f
 
49b67f
 	return NULL;
49b67f
 }
49b67f
 
49b67f
-static void tree_free(struct node *tree)
49b67f
+static void tree_free(struct tree_node *root)
49b67f
 {
49b67f
-	if (tree->right)
49b67f
-		tree_free(tree->right);
49b67f
-	if (tree->left)
49b67f
-		tree_free(tree->left);
49b67f
-	free(tree);
49b67f
-}
49b67f
-
49b67f
-static void traverse(struct node *node, struct list_head *mnts)
49b67f
-{
49b67f
-	if (node->right)
49b67f
-		traverse(node->right, mnts);
49b67f
-	list_add_tail(&node->mnt->expire, mnts);
49b67f
-	if (node->left)
49b67f
-		traverse(node->left, mnts);
49b67f
+	if (root->right)
49b67f
+		tree_free(root->right);
49b67f
+	if (root->left)
49b67f
+		tree_free(root->left);
49b67f
+	free(root);
49b67f
+}
49b67f
+
49b67f
+static void tree_traverse(struct tree_node *n, struct list_head *mnts)
49b67f
+{
49b67f
+	if (n->right)
49b67f
+		tree_traverse(n->right, mnts);
49b67f
+	list_add_tail(&n->mnt->expire, mnts);
49b67f
+	if (n->left)
49b67f
+		tree_traverse(n->left, mnts);
49b67f
 }
49b67f
 
49b67f
 void mnts_get_expire_list(struct list_head *mnts, struct autofs_point *ap)
49b67f
 {
49b67f
 	struct mnt_list *mnt;
49b67f
-	struct node *tree = NULL;
49b67f
+	struct tree_node *tree = NULL;
49b67f
 
49b67f
 	mnts_hash_mutex_lock();
49b67f
 	if (list_empty(&ap->mounts))
49b67f
 		goto done;
49b67f
 
49b67f
 	list_for_each_entry(mnt, &ap->mounts, mount) {
49b67f
-		struct node *n;
49b67f
+		struct tree_node *n;
49b67f
 
49b67f
 		if (!(mnt->flags & MNTS_MOUNTED))
49b67f
 			continue;
49b67f
@@ -1359,7 +1359,7 @@ void mnts_get_expire_list(struct list_he
49b67f
 			continue;
49b67f
 		}
49b67f
 
49b67f
-		n = add_node(tree, mnt);
49b67f
+		n = tree_add_node(tree, mnt);
49b67f
 		if (!n) {
49b67f
 			error(LOGOPT_ANY, "failed to add expire tree node");
49b67f
 			tree_free(tree);
49b67f
@@ -1367,7 +1367,7 @@ void mnts_get_expire_list(struct list_he
49b67f
 		}
49b67f
 	}
49b67f
 
49b67f
-	traverse(tree, mnts);
49b67f
+	tree_traverse(tree, mnts);
49b67f
 	tree_free(tree);
49b67f
 done:
49b67f
 	mnts_hash_mutex_unlock();