From: Adrian Hunter <ext-adrian.hunter@nokia.com>
To: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>
Subject: [PATCH 2/3] [MTD-UTILS] fs-tests: fix max file name length in integrity test
Date: Tue, 12 Aug 2008 14:08:11 +0300 [thread overview]
Message-ID: <48A16F1B.4040700@nokia.com> (raw)
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
---
tests/fs-tests/integrity/integck.c | 2 +-
tests/fs-tests/lib/tests.c | 4 ++++
tests/fs-tests/lib/tests.h | 3 +++
3 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
index f1a544a..ab69343 100644
--- a/tests/fs-tests/integrity/integck.c
+++ b/tests/fs-tests/integrity/integck.c
@@ -1388,7 +1388,7 @@ static char *make_name(struct dir_info *dir)
do {
found = 0;
if (tests_random_no(5) == 1) {
- int i, n = tests_random_no(255) + 1;
+ int i, n = tests_random_no(tests_max_fname_len) + 1;
CHECK(n > 0 && n < 256);
for (i = 0; i < n; i++)
diff --git a/tests/fs-tests/lib/tests.c b/tests/fs-tests/lib/tests.c
index 97e5207..570672f 100644
--- a/tests/fs-tests/lib/tests.c
+++ b/tests/fs-tests/lib/tests.c
@@ -83,6 +83,9 @@ int tests_hole_flag = 0;
/* Whether it is ok to test on the root file system */
static int rootok = 0;
+/* Maximum file name length of test file system (from statfs) */
+long tests_max_fname_len = 255;
+
/* Function invoked by the CHECK macro */
void tests_test(int test,const char *msg,const char *file,unsigned line)
{
@@ -370,6 +373,7 @@ void tests_check_test_file_system(void)
"TEST_FILE_SYSTEM_MOUNT_DIR\n");
CHECK(0);
}
+ tests_max_fname_len = fs_info.f_namelen;
if (strcmp(tests_file_system_type, "jffs2") == 0 &&
fs_info.f_type != JFFS2_SUPER_MAGIC) {
fprintf(stderr, "File system type is not jffs2\n");
diff --git a/tests/fs-tests/lib/tests.h b/tests/fs-tests/lib/tests.h
index 04c834d..01849bc 100644
--- a/tests/fs-tests/lib/tests.h
+++ b/tests/fs-tests/lib/tests.h
@@ -202,4 +202,7 @@ extern int tests_hole_flag;
/* Program name from argv[0] */
extern char *program_name;
+/* Maximum file name length of test file system (from statfs) */
+extern long tests_max_fname_len;
+
#endif
--
1.5.4.3
reply other threads:[~2008-08-12 11:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=48A16F1B.4040700@nokia.com \
--to=ext-adrian.hunter@nokia.com \
--cc=linux-mtd@lists.infradead.org \
/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