public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Edward Liaw via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Cc: kernel-team@android.com
Subject: [LTP] [PATCH v3 2/4] set_dev_loop_path: Change return value to zero on success
Date: Fri, 24 Mar 2023 00:24:39 +0000	[thread overview]
Message-ID: <20230324002441.987778-3-edliaw@google.com> (raw)
In-Reply-To: <20230324002441.987778-1-edliaw@google.com>

set_dev_loop_path was returning 1 on success and 0 on error, which is
inconsistent with the other functions in this file.  Change it to 0 on
success and 1 on error.

Signed-off-by: Edward Liaw <edliaw@google.com>
---
 lib/tst_device.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/tst_device.c b/lib/tst_device.c
index 5d057570c..2c83fb764 100644
--- a/lib/tst_device.c
+++ b/lib/tst_device.c
@@ -69,10 +69,10 @@ static int set_dev_loop_path(int dev, char *path, size_t path_len)
 		snprintf(path, path_len, dev_loop_variants[i], dev);
 
 		if (stat(path, &st) == 0 && S_ISBLK(st.st_mode))
-			return 1;
+			return 0;
 	}
 
-	return 0;
+	return 1;
 }
 
 int tst_find_free_loopdev(char *path, size_t path_len)
@@ -116,7 +116,7 @@ int tst_find_free_loopdev(char *path, size_t path_len)
 	 */
 	for (i = 0; i < 256; i++) {
 
-		if (!set_dev_loop_path(i, buf, sizeof(buf)))
+		if (set_dev_loop_path(i, buf, sizeof(buf)))
 			continue;
 
 		dev_fd = open(buf, O_RDONLY);
-- 
2.40.0.348.gf938b09366-goog


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2023-03-24  0:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-24  0:24 [LTP] [PATCH v3 0/4] tst_device.c: Handle Android path for backing device Edward Liaw via ltp
2023-03-24  0:24 ` [LTP] [PATCH v3 1/4] set_dev_path: Rename to set_dev_loop_path Edward Liaw via ltp
2023-03-27  7:43   ` Petr Vorel
2023-03-24  0:24 ` Edward Liaw via ltp [this message]
2023-03-27  7:43   ` [LTP] [PATCH v3 2/4] set_dev_loop_path: Change return value to zero on success Petr Vorel
2023-03-24  0:24 ` [LTP] [PATCH v3 3/4] tst_find_free_loopdev: Check return value of set_dev_loop_path Edward Liaw via ltp
2023-03-27  7:44   ` Petr Vorel
2023-03-24  0:24 ` [LTP] [PATCH v3 4/4] tst_find_backing_dev: Also check /dev/block/ for backing device Edward Liaw via ltp
2023-03-27  9:36   ` Petr Vorel
2023-03-27 15:26   ` Cyril Hrubis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230324002441.987778-3-edliaw@google.com \
    --to=ltp@lists.linux.it \
    --cc=edliaw@google.com \
    --cc=kernel-team@android.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox