-struct fio_zipf_disk {
- uint64_t ver_magic;
- uint64_t nranges;
- uint64_t zetan;
-};
-
-#define FIO_ZIPF_DISK_MAGIC 0x7a697066
-#define FIO_ZIPF_DISK_VER 1
-#define FIO_ZIPF_MAGIC ((FIO_ZIPF_DISK_MAGIC << 16) | FIO_ZIPF_DISK_VER)
-
-static void write_zipf(struct zipf_state *zs)
-{
- struct fio_zipf_disk f;
- char tmp[80];
- int fd;
-
- sprintf(tmp, "fio.zipf.%f.%llu", zs->theta, (unsigned long long) zs->nranges);
- fd = open(tmp, O_CREAT | O_WRONLY, 0644);
- if (fd == -1)
- return;
-
- f.ver_magic = __cpu_to_le64(FIO_ZIPF_MAGIC);
- f.nranges = __cpu_to_le64(zs->nranges);
- f.zetan = __cpu_to_le64(fio_double_to_uint64(zs->zetan));
- if (write(fd, &f, sizeof(f)) != sizeof(f))
- unlink(tmp);
-
- close(fd);
-}