[PATCH 27/42] state: backend_storage: Rename variable desired_copies to desired_buckets

Sascha Hauer s.hauer at pengutronix.de
Fri Mar 31 00:03:31 PDT 2017


We defined what a bucket is, so rename the variable that holds the
number of desired buckets from desired_copies to desired_buckets.

While at it, make locally used variable static.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 common/state/backend_storage.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/common/state/backend_storage.c b/common/state/backend_storage.c
index c29004071b..1310531dd1 100644
--- a/common/state/backend_storage.c
+++ b/common/state/backend_storage.c
@@ -216,8 +216,8 @@ static int mtd_get_meminfo(const char *path, struct mtd_info_user *meminfo)
 	return ret;
 }
 
-/* Number of copies that should be allocated */
-const int desired_copies = 3;
+/* Number of buckets that should be used */
+static const int desired_buckets = 3;
 
 /**
  * state_storage_mtd_buckets_init - Creates storage buckets for mtd devices
@@ -270,7 +270,7 @@ static int state_storage_mtd_buckets_init(struct state_backend_storage *storage,
 
 		list_add_tail(&bucket->bucket_list, &storage->buckets);
 		++n_buckets;
-		if (n_buckets >= desired_copies)
+		if (n_buckets >= desired_buckets)
 			return 0;
 	}
 
@@ -280,7 +280,7 @@ static int state_storage_mtd_buckets_init(struct state_backend_storage *storage,
 	}
 
 	dev_warn(storage->dev, "Failed to initialize desired amount of buckets, only %d of %d succeeded\n",
-		 n_buckets, desired_copies);
+		 n_buckets, desired_buckets);
 	return 0;
 }
 
@@ -306,12 +306,12 @@ static int state_storage_file_buckets_init(struct state_backend_storage *storage
 		return -EINVAL;
 	}
 
-	if (max_size && max_size < desired_copies * stridesize) {
-		dev_err(storage->dev, "device is too small to hold %d copies\n", desired_copies);
+	if (max_size && max_size < desired_buckets * stridesize) {
+		dev_err(storage->dev, "device is too small to hold %d copies\n", desired_buckets);
 		return -EINVAL;
 	}
 
-	for (n = 0; n < desired_copies; n++) {
+	for (n = 0; n < desired_buckets; n++) {
 		offset = storage->offset + n * stridesize;
 		ret = state_backend_bucket_direct_create(storage->dev, storage->path,
 							 &bucket, offset,
@@ -334,9 +334,9 @@ static int state_storage_file_buckets_init(struct state_backend_storage *storage
 		return -EIO;
 	}
 
-	if (n_buckets < desired_copies)
+	if (n_buckets < desired_buckets)
 		dev_warn(storage->dev, "Failed to initialize desired amount of direct buckets, only %d of %d succeeded\n",
-			n_buckets, desired_copies);
+			n_buckets, desired_buckets);
 
 	return 0;
 }
-- 
2.11.0




More information about the barebox mailing list