Add check for pipe/fifo files
authorJens Axboe <jens.axboe@oracle.com>
Mon, 16 Apr 2007 18:42:33 +0000 (20:42 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 16 Apr 2007 18:42:33 +0000 (20:42 +0200)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
filesetup.c
fio.h

index bd975d82470ce4dc7bedb82a5f1cbd151e5574c1..bb25cd5c20bf43ea46646f3b5fb799637e23f5f2 100644 (file)
@@ -181,7 +181,7 @@ int file_invalidate_cache(struct thread_data *td, struct fio_file *f)
                        log_err("fio: only root may flush block devices. Cache flush bypassed!\n");
                        ret = 0;
                }
                        log_err("fio: only root may flush block devices. Cache flush bypassed!\n");
                        ret = 0;
                }
-       } else if (f->filetype == FIO_TYPE_CHAR)
+       } else if (f->filetype == FIO_TYPE_CHAR || f->filetype == FIO_TYPE_PIPE)
                ret = 0;
 
        if (ret < 0) {
                ret = 0;
 
        if (ret < 0) {
@@ -485,6 +485,8 @@ static void get_file_type(struct fio_file *f)
                        f->filetype = FIO_TYPE_BD;
                else if (S_ISCHR(sb.st_mode))
                        f->filetype = FIO_TYPE_CHAR;
                        f->filetype = FIO_TYPE_BD;
                else if (S_ISCHR(sb.st_mode))
                        f->filetype = FIO_TYPE_CHAR;
+               else if (S_ISFIFO(sb.st_mode))
+                       f->filetype = FIO_TYPE_PIPE;
        }
 }
 
        }
 }
 
diff --git a/fio.h b/fio.h
index 1a318921c59eb6b7c620559455537e4f8240d52d..7ac5734308bff9d72bfa2b2a8c6b93844fdb994c 100644 (file)
--- a/fio.h
+++ b/fio.h
@@ -224,6 +224,7 @@ enum fio_filetype {
        FIO_TYPE_FILE = 1,              /* plain file */
        FIO_TYPE_BD,                    /* block device */
        FIO_TYPE_CHAR,                  /* character device */
        FIO_TYPE_FILE = 1,              /* plain file */
        FIO_TYPE_BD,                    /* block device */
        FIO_TYPE_CHAR,                  /* character device */
+       FIO_TYPE_PIPE,                  /* pipe */
 };
 
 enum fio_ioengine_flags {
 };
 
 enum fio_ioengine_flags {