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

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

 



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@xxxxxxxxxxxxxx>
---
 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


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux