Makefile: Fix android compilation
[fio.git] / oslib / linux-blkzoned.c
index 84a64ed3014e04bd7eb188df5d491ad45b78a71f..185bd5011bbc5105e7bf67a171b0d93a93727ae2 100644 (file)
@@ -140,10 +140,8 @@ int blkzoned_get_zoned_model(struct thread_data *td, struct fio_file *f,
 {
        char *model_str = NULL;
 
-       if (f->filetype != FIO_TYPE_BLOCK) {
-               *model = ZBD_IGNORE;
-               return 0;
-       }
+       if (f->filetype != FIO_TYPE_BLOCK)
+               return -EINVAL;
 
        *model = ZBD_NONE;
 
@@ -162,6 +160,29 @@ int blkzoned_get_zoned_model(struct thread_data *td, struct fio_file *f,
        return 0;
 }
 
+int blkzoned_get_max_open_zones(struct thread_data *td, struct fio_file *f,
+                               unsigned int *max_open_zones)
+{
+       char *max_open_str;
+
+       if (f->filetype != FIO_TYPE_BLOCK)
+               return -EIO;
+
+       max_open_str = blkzoned_get_sysfs_attr(f->file_name, "queue/max_open_zones");
+       if (!max_open_str) {
+               *max_open_zones = 0;
+               return 0;
+       }
+
+       dprint(FD_ZBD, "%s: max open zones supported by device: %s\n",
+              f->file_name, max_open_str);
+       *max_open_zones = atoll(max_open_str);
+
+       free(max_open_str);
+
+       return 0;
+}
+
 static uint64_t zone_capacity(struct blk_zone_report *hdr,
                              struct blk_zone *blkz)
 {