Merge branch 'lintian-manpage-fixes' of https://github.com/hoexter/fio
[fio.git] / oslib / blkzoned.h
1 /*
2  * Copyright (C) 2020 Western Digital Corporation or its affiliates.
3  *
4  * This file is released under the GPL.
5  */
6 #ifndef FIO_BLKZONED_H
7 #define FIO_BLKZONED_H
8
9 #include "zbd_types.h"
10
11 #ifdef CONFIG_HAS_BLKZONED
12 extern int blkzoned_get_zoned_model(struct thread_data *td,
13                         struct fio_file *f, enum zbd_zoned_model *model);
14 extern int blkzoned_report_zones(struct thread_data *td,
15                                 struct fio_file *f, uint64_t offset,
16                                 struct zbd_zone *zones, unsigned int nr_zones);
17 extern int blkzoned_reset_wp(struct thread_data *td, struct fio_file *f,
18                                 uint64_t offset, uint64_t length);
19 extern int blkzoned_get_max_open_zones(struct thread_data *td, struct fio_file *f,
20                                        unsigned int *max_open_zones);
21 extern int blkzoned_finish_zone(struct thread_data *td, struct fio_file *f,
22                                 uint64_t offset, uint64_t length);
23 #else
24 /*
25  * Define stubs for systems that do not have zoned block device support.
26  */
27 static inline int blkzoned_get_zoned_model(struct thread_data *td,
28                         struct fio_file *f, enum zbd_zoned_model *model)
29 {
30         /*
31          * If this is a block device file, allow zbd emulation.
32          */
33         if (f->filetype == FIO_TYPE_BLOCK) {
34                 *model = ZBD_NONE;
35                 return 0;
36         }
37
38         return -ENODEV;
39 }
40 static inline int blkzoned_report_zones(struct thread_data *td,
41                                 struct fio_file *f, uint64_t offset,
42                                 struct zbd_zone *zones, unsigned int nr_zones)
43 {
44         return -EIO;
45 }
46 static inline int blkzoned_reset_wp(struct thread_data *td, struct fio_file *f,
47                                     uint64_t offset, uint64_t length)
48 {
49         return -EIO;
50 }
51 static inline int blkzoned_get_max_open_zones(struct thread_data *td, struct fio_file *f,
52                                               unsigned int *max_open_zones)
53 {
54         return -EIO;
55 }
56 static inline int blkzoned_finish_zone(struct thread_data *td,
57                                        struct fio_file *f,
58                                        uint64_t offset, uint64_t length)
59 {
60         return -EIO;
61 }
62 #endif
63
64 #endif /* FIO_BLKZONED_H */