All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] nfs01_open_files: Fix pattern for deleted files
@ 2022-03-11 11:00 Petr Vorel
  2022-03-11 11:08 ` Petr Vorel
  2022-03-11 12:43 ` Cyril Hrubis
  0 siblings, 2 replies; 4+ messages in thread
From: Petr Vorel @ 2022-03-11 11:00 UTC (permalink / raw)
  To: ltp; +Cc: Neil Brown

Fixes: 0989fe65f3 ("Corrected the export lines in nfs01 ...")

Reported-by: Neil Brown <neilb@suse.de>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/network/nfs/nfs_stress/nfs01_open_files.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/testcases/network/nfs/nfs_stress/nfs01_open_files.c b/testcases/network/nfs/nfs_stress/nfs01_open_files.c
index 9342f11ba9..c5627058dc 100644
--- a/testcases/network/nfs/nfs_stress/nfs01_open_files.c
+++ b/testcases/network/nfs/nfs_stress/nfs01_open_files.c
@@ -10,7 +10,8 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-#define TEMPLATE "ltpXXXXXX"
+#define TEMPLATE_PREFIX "ltp"
+#define TEMPLATE TEMPLATE_PREFIX "XXXXXX"
 
 int write_something(int);
 void delete_files(void);
@@ -101,7 +102,7 @@ void delete_files(void)
 
 	dirp = opendir(".");
 	for (entp = readdir(dirp); entp; entp = readdir(dirp))
-		if (!strncmp(entp->d_name, "apt", 3)) {
+		if (!strncmp(entp->d_name, TEMPLATE_PREFIX, 3)) {
 			if (stat(entp->d_name, &stat_buffer))
 				abortx("stat() failed for \"%s\", errno = %d",
 				       entp->d_name, errno);
-- 
2.35.1


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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH 1/1] nfs01_open_files: Fix pattern for deleted files
  2022-03-11 11:00 [LTP] [PATCH 1/1] nfs01_open_files: Fix pattern for deleted files Petr Vorel
@ 2022-03-11 11:08 ` Petr Vorel
  2022-03-11 12:43 ` Cyril Hrubis
  1 sibling, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2022-03-11 11:08 UTC (permalink / raw)
  To: ltp

> Fixes: 0989fe65f3 ("Corrected the export lines in nfs01 ...")

commit 0989fe65f306 in 2001 changed the names of created files from apt to ltp,
but didn't change the names of deleted files.

Kind regards,
Petr

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH 1/1] nfs01_open_files: Fix pattern for deleted files
  2022-03-11 11:00 [LTP] [PATCH 1/1] nfs01_open_files: Fix pattern for deleted files Petr Vorel
  2022-03-11 11:08 ` Petr Vorel
@ 2022-03-11 12:43 ` Cyril Hrubis
  2022-03-11 14:50   ` Petr Vorel
  1 sibling, 1 reply; 4+ messages in thread
From: Cyril Hrubis @ 2022-03-11 12:43 UTC (permalink / raw)
  To: Petr Vorel; +Cc: Neil Brown, ltp

Hi!
> Reported-by: Neil Brown <neilb@suse.de>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/network/nfs/nfs_stress/nfs01_open_files.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/testcases/network/nfs/nfs_stress/nfs01_open_files.c b/testcases/network/nfs/nfs_stress/nfs01_open_files.c
> index 9342f11ba9..c5627058dc 100644
> --- a/testcases/network/nfs/nfs_stress/nfs01_open_files.c
> +++ b/testcases/network/nfs/nfs_stress/nfs01_open_files.c
> @@ -10,7 +10,8 @@
>  #include <sys/stat.h>
>  #include <unistd.h>
>  
> -#define TEMPLATE "ltpXXXXXX"
> +#define TEMPLATE_PREFIX "ltp"
> +#define TEMPLATE TEMPLATE_PREFIX "XXXXXX"
>  
>  int write_something(int);
>  void delete_files(void);
> @@ -101,7 +102,7 @@ void delete_files(void)
>  
>  	dirp = opendir(".");
>  	for (entp = readdir(dirp); entp; entp = readdir(dirp))
> -		if (!strncmp(entp->d_name, "apt", 3)) {
> +		if (!strncmp(entp->d_name, TEMPLATE_PREFIX, 3)) {

Maybe we should also do:

#define TEMPLATE_PREFIX_LEN (sizeof(TEMPLATE_PREFIX) - 1)

And use TEMPLATE_PREFIX_LEN instead of the hardcoded 3


Otherwise it looks obviously correct:

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [LTP] [PATCH 1/1] nfs01_open_files: Fix pattern for deleted files
  2022-03-11 12:43 ` Cyril Hrubis
@ 2022-03-11 14:50   ` Petr Vorel
  0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2022-03-11 14:50 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: Neil Brown, ltp

Hi Cyril,

...
> Maybe we should also do:

> #define TEMPLATE_PREFIX_LEN (sizeof(TEMPLATE_PREFIX) - 1)

> And use TEMPLATE_PREFIX_LEN instead of the hardcoded 3

+1, thanks, merged with this change.

Kind regards,
Petr

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-11 14:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-11 11:00 [LTP] [PATCH 1/1] nfs01_open_files: Fix pattern for deleted files Petr Vorel
2022-03-11 11:08 ` Petr Vorel
2022-03-11 12:43 ` Cyril Hrubis
2022-03-11 14:50   ` Petr Vorel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.