diff mbox series

[v4,1/4] set_dev_path: Rename to set_dev_loop_path

Message ID 20230327161145.1702680-2-edliaw@google.com
State Accepted
Headers show
Series tst_device.c: Handle Android path for backing device | expand

Commit Message

Edward Liaw March 27, 2023, 4:11 p.m. UTC
Rename set_dev_path to set_dev_loop_path and the array dev_variants to
dev_loop_variants.  This will differentiate it from adding a similar
function that is checking a more generic dev path.

Signed-off-by: Edward Liaw <edliaw@google.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
---
 lib/tst_device.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/lib/tst_device.c b/lib/tst_device.c
index b4a6b8e82..82550dbcd 100644
--- a/lib/tst_device.c
+++ b/lib/tst_device.c
@@ -54,19 +54,19 @@  static char dev_path[PATH_MAX];
 static int device_acquired;
 static unsigned long prev_dev_sec_write;
 
-static const char *dev_variants[] = {
+static const char *dev_loop_variants[] = {
 	"/dev/loop%i",
 	"/dev/loop/%i",
 	"/dev/block/loop%i"
 };
 
-static int set_dev_path(int dev, char *path, size_t path_len)
+static int set_dev_loop_path(int dev, char *path, size_t path_len)
 {
 	unsigned int i;
 	struct stat st;
 
-	for (i = 0; i < ARRAY_SIZE(dev_variants); i++) {
-		snprintf(path, path_len, dev_variants[i], dev);
+	for (i = 0; i < ARRAY_SIZE(dev_loop_variants); i++) {
+		snprintf(path, path_len, dev_loop_variants[i], dev);
 
 		if (stat(path, &st) == 0 && S_ISBLK(st.st_mode))
 			return 1;
@@ -89,7 +89,7 @@  int tst_find_free_loopdev(char *path, size_t path_len)
 		close(ctl_fd);
 		if (rc >= 0) {
 			if (path)
-				set_dev_path(rc, path, path_len);
+				set_dev_loop_path(rc, path, path_len);
 			tst_resm(TINFO, "Found free device %d '%s'",
 				rc, path ?: "");
 			return rc;
@@ -116,7 +116,7 @@  int tst_find_free_loopdev(char *path, size_t path_len)
 	 */
 	for (i = 0; i < 256; i++) {
 
-		if (!set_dev_path(i, buf, sizeof(buf)))
+		if (!set_dev_loop_path(i, buf, sizeof(buf)))
 			continue;
 
 		dev_fd = open(buf, O_RDONLY);