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

29d2b9
autofs-5.1.7 - rename tree implementation functions
29d2b9
29d2b9
From: Ian Kent <raven@themaw.net>
29d2b9
29d2b9
Rename the tree struct and functions to make them consistent.
29d2b9
29d2b9
Signed-off-by: Ian Kent <raven@themaw.net>
29d2b9
---
29d2b9
 CHANGELOG    |    1 +
29d2b9
 lib/mounts.c |   80 +++++++++++++++++++++++++++++-----------------------------
29d2b9
 2 files changed, 41 insertions(+), 40 deletions(-)
29d2b9
29d2b9
diff --git a/CHANGELOG b/CHANGELOG
29d2b9
index 2a07bd45..1bf20699 100644
29d2b9
--- a/CHANGELOG
29d2b9
+++ b/CHANGELOG
29d2b9
@@ -27,6 +27,7 @@
29d2b9
 - cleanup cache_delete() a little.
29d2b9
 - rename path to m_offset in update_offset_entry().
29d2b9
 - don't pass root to do_mount_autofs_offset().
29d2b9
+- rename tree implementation functions.
29d2b9
 
29d2b9
 25/01/2021 autofs-5.1.7
29d2b9
 - make bind mounts propagation slave by default.
29d2b9
diff --git a/lib/mounts.c b/lib/mounts.c
29d2b9
index 289500da..f5b905a6 100644
29d2b9
--- a/lib/mounts.c
29d2b9
+++ b/lib/mounts.c
29d2b9
@@ -1225,30 +1225,30 @@ done:
29d2b9
 	return has_mounted_mounts;
29d2b9
 }
29d2b9
 
29d2b9
-struct node {
29d2b9
+struct tree_node {
29d2b9
 	struct mnt_list *mnt;
29d2b9
-	struct node *left;
29d2b9
-	struct node *right;
29d2b9
+	struct tree_node *left;
29d2b9
+	struct tree_node *right;
29d2b9
 };
29d2b9
 
29d2b9
-static struct node *new(struct mnt_list *mnt)
29d2b9
+static struct tree_node *tree_new(struct mnt_list *mnt)
29d2b9
 {
29d2b9
-	struct node *n;
29d2b9
+	struct tree_node *n;
29d2b9
 
29d2b9
-	n = malloc(sizeof(struct node));
29d2b9
+	n = malloc(sizeof(struct tree_node));
29d2b9
 	if (!n)
29d2b9
 		return NULL;
29d2b9
-	memset(n, 0, sizeof(struct node));
29d2b9
+	memset(n, 0, sizeof(struct tree_node));
29d2b9
 	n->mnt = mnt;
29d2b9
 
29d2b9
 	return n;
29d2b9
 }
29d2b9
 
29d2b9
-static struct node *tree_root(struct mnt_list *mnt)
29d2b9
+static struct tree_node *tree_root(struct mnt_list *mnt)
29d2b9
 {
29d2b9
-	struct node *n;
29d2b9
+	struct tree_node *n;
29d2b9
 
29d2b9
-	n = new(mnt);
29d2b9
+	n = tree_new(mnt);
29d2b9
 	if (!n) {
29d2b9
 		error(LOGOPT_ANY, "failed to allcate tree root");
29d2b9
 		return NULL;
29d2b9
@@ -1257,37 +1257,37 @@ static struct node *tree_root(struct mnt_list *mnt)
29d2b9
 	return n;
29d2b9
 }
29d2b9
 
29d2b9
-static struct node *add_left(struct node *this, struct mnt_list *mnt)
29d2b9
+static struct tree_node *tree_add_left(struct tree_node *n, struct mnt_list *mnt)
29d2b9
 {
29d2b9
-	struct node *n;
29d2b9
+	struct tree_node *new;
29d2b9
 
29d2b9
-	n = new(mnt);
29d2b9
-	if (!n) {
29d2b9
+	new = tree_new(mnt);
29d2b9
+	if (!new) {
29d2b9
 		error(LOGOPT_ANY, "failed to allcate tree node");
29d2b9
 		return NULL;
29d2b9
 	}
29d2b9
-	this->left = n;
29d2b9
+	n->left = new;
29d2b9
 
29d2b9
 	return n;
29d2b9
 }
29d2b9
 
29d2b9
-static struct node *add_right(struct node *this, struct mnt_list *mnt)
29d2b9
+static struct tree_node *tree_add_right(struct tree_node *n, struct mnt_list *mnt)
29d2b9
 {
29d2b9
-	struct node *n;
29d2b9
+	struct tree_node *new;
29d2b9
 
29d2b9
-	n = new(mnt);
29d2b9
-	if (!n) {
29d2b9
+	new = tree_new(mnt);
29d2b9
+	if (!new) {
29d2b9
 		error(LOGOPT_ANY, "failed to allcate tree node");
29d2b9
 		return NULL;
29d2b9
 	}
29d2b9
-	this->right = n;
29d2b9
+	n->right = new;
29d2b9
 
29d2b9
 	return n;
29d2b9
 }
29d2b9
 
29d2b9
-static struct node *add_node(struct node *root, struct mnt_list *mnt)
29d2b9
+static struct tree_node *tree_add_node(struct tree_node *root, struct mnt_list *mnt)
29d2b9
 {
29d2b9
-	struct node *p, *q;
29d2b9
+	struct tree_node *p, *q;
29d2b9
 	unsigned int mp_len;
29d2b9
 
29d2b9
 	mp_len = strlen(mnt->mp);
29d2b9
@@ -1307,43 +1307,43 @@ static struct node *add_node(struct node *root, struct mnt_list *mnt)
29d2b9
 		error(LOGOPT_ANY, "duplicate entry in mounts list");
29d2b9
 	else {
29d2b9
 		if (mp_len < strlen(p->mnt->mp))
29d2b9
-			return add_left(p, mnt);
29d2b9
+			return tree_add_left(p, mnt);
29d2b9
 		else
29d2b9
-			return add_right(p, mnt);
29d2b9
+			return tree_add_right(p, mnt);
29d2b9
 	}
29d2b9
 
29d2b9
 	return NULL;
29d2b9
 }
29d2b9
 
29d2b9
-static void tree_free(struct node *tree)
29d2b9
+static void tree_free(struct tree_node *root)
29d2b9
 {
29d2b9
-	if (tree->right)
29d2b9
-		tree_free(tree->right);
29d2b9
-	if (tree->left)
29d2b9
-		tree_free(tree->left);
29d2b9
-	free(tree);
29d2b9
+	if (root->right)
29d2b9
+		tree_free(root->right);
29d2b9
+	if (root->left)
29d2b9
+		tree_free(root->left);
29d2b9
+	free(root);
29d2b9
 }
29d2b9
 
29d2b9
-static void traverse(struct node *node, struct list_head *mnts)
29d2b9
+static void tree_traverse(struct tree_node *n, struct list_head *mnts)
29d2b9
 {
29d2b9
-	if (node->right)
29d2b9
-		traverse(node->right, mnts);
29d2b9
-	list_add_tail(&node->mnt->expire, mnts);
29d2b9
-	if (node->left)
29d2b9
-		traverse(node->left, mnts);
29d2b9
+	if (n->right)
29d2b9
+		tree_traverse(n->right, mnts);
29d2b9
+	list_add_tail(&n->mnt->expire, mnts);
29d2b9
+	if (n->left)
29d2b9
+		tree_traverse(n->left, mnts);
29d2b9
 }
29d2b9
 
29d2b9
 void mnts_get_expire_list(struct list_head *mnts, struct autofs_point *ap)
29d2b9
 {
29d2b9
 	struct mnt_list *mnt;
29d2b9
-	struct node *tree = NULL;
29d2b9
+	struct tree_node *tree = NULL;
29d2b9
 
29d2b9
 	mnts_hash_mutex_lock();
29d2b9
 	if (list_empty(&ap->mounts))
29d2b9
 		goto done;
29d2b9
 
29d2b9
 	list_for_each_entry(mnt, &ap->mounts, mount) {
29d2b9
-		struct node *n;
29d2b9
+		struct tree_node *n;
29d2b9
 
29d2b9
 		if (!(mnt->flags & MNTS_MOUNTED))
29d2b9
 			continue;
29d2b9
@@ -1359,7 +1359,7 @@ void mnts_get_expire_list(struct list_head *mnts, struct autofs_point *ap)
29d2b9
 			continue;
29d2b9
 		}
29d2b9
 
29d2b9
-		n = add_node(tree, mnt);
29d2b9
+		n = tree_add_node(tree, mnt);
29d2b9
 		if (!n) {
29d2b9
 			error(LOGOPT_ANY, "failed to add expire tree node");
29d2b9
 			tree_free(tree);
29d2b9
@@ -1367,7 +1367,7 @@ void mnts_get_expire_list(struct list_head *mnts, struct autofs_point *ap)
29d2b9
 		}
29d2b9
 	}
29d2b9
 
29d2b9
-	traverse(tree, mnts);
29d2b9
+	tree_traverse(tree, mnts);
29d2b9
 	tree_free(tree);
29d2b9
 done:
29d2b9
 	mnts_hash_mutex_unlock();