[LTP] [PATCH] fs_fill: switch the SAFE MACROs back to ordinary syscall

Cyril Hrubis chrubis@suse.cz
Tue Nov 21 10:44:45 CET 2017


Hi!
> > But I can always change that in a follow up patch...
> 
> How about this following change:
> 
> --- a/testcases/kernel/fs/fs_fill/fs_fill.c
> +++ b/testcases/kernel/fs/fs_fill/fs_fill.c
> @@ -41,21 +41,11 @@ struct worker {
> 
>  static void *worker(void *p)
>  {
> -       int ret;
>         struct worker *w = p;
>         DIR *d;
>         struct dirent *ent;
>         char file[PATH_MAX];
> 
> -       ret = mkdir(w->dir, 0700);
> -       if (ret == -1) {
> -               if (errno != ENOSPC)
> -                       tst_brk(TBROK | TERRNO, "mkdir()");
> -
> -               tst_res(TINFO | TERRNO, "mkdir()");
> -               return NULL;
> -       }
> -
>         while (run) {
>                 tst_fill_fs(w->dir, 0);
> 
> @@ -92,6 +82,10 @@ static void testrun(void)
>         for (i = 0; i < nthreads; i++) {
>                 snprintf(workers[i].dir, sizeof(workers[i].dir),
>                          MNTPOINT "/thread%i", i + 1);
> +               SAFE_MKDIR(workers[i].dir, 0700);
> +       }
> +
> +       for (i = 0; i < nthreads; i++) {
>                 SAFE_PTHREAD_CREATE(&threads[i], NULL, worker, &workers[i]);
>         }

This one looks cleaner to me.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list