zfs/module/zpios/include/zpios-ctl.h

121 lines
3.7 KiB
C
Raw Normal View History

2008-12-05 19:32:34 +00:00
/*
* This file is part of the ZFS Linux port.
*
* Copyright (c) 2008 Lawrence Livermore National Security, LLC.
* Produced at Lawrence Livermore National Laboratory
* Written by:
* Brian Behlendorf <behlendorf1@llnl.gov>,
* Herb Wartens <wartens2@llnl.gov>,
* Jim Garlick <garlick@llnl.gov>
* LLNL-CODE-403049
*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
2009-01-14 16:38:35 +00:00
#ifndef _ZPIOS_CTL_H
#define _ZPIOS_CTL_H
2008-12-05 19:32:34 +00:00
/* Contains shared definitions which both the userspace
2009-01-14 16:38:35 +00:00
* and kernelspace portions of zpios must agree on.
2008-12-05 19:32:34 +00:00
*/
#ifndef _KERNEL
#include <stdint.h>
#endif
2009-01-14 16:38:35 +00:00
#define ZPIOS_MAJOR 232 /* XXX - Arbitrary */
#define ZPIOS_MINORS 1
#define ZPIOS_DEV "/dev/zpios"
2008-12-05 19:32:34 +00:00
#define DMU_IO 0x01
#define DMU_WRITE 0x01
#define DMU_READ 0x02
#define DMU_VERIFY 0x04
#define DMU_REMOVE 0x08
#define DMU_FPP 0x10
#define DMU_WRITE_ZC 0x20 /* Incompatible with DMU_VERIFY */
#define DMU_READ_ZC 0x40 /* Incompatible with DMU_VERIFY */
2009-01-14 16:38:35 +00:00
#define ZPIOS_NAME_SIZE 16
#define ZPIOS_PATH_SIZE 128
2008-12-05 19:32:34 +00:00
#define PHASE_PRE "pre"
#define PHASE_POST "post"
#define PHASE_WRITE "write"
#define PHASE_READ "read"
2009-01-14 16:38:35 +00:00
#define ZPIOS_CFG_MAGIC 0x87237190U
typedef struct zpios_cfg {
2008-12-05 19:32:34 +00:00
uint32_t cfg_magic; /* Unique magic */
int32_t cfg_cmd; /* Config command */
int32_t cfg_arg1; /* Config command arg 1 */
int32_t cfg_rc1; /* Config response 1 */
2009-01-14 16:38:35 +00:00
} zpios_cfg_t;
2008-12-05 19:32:34 +00:00
2009-01-14 16:38:35 +00:00
typedef struct zpios_time {
2008-12-05 19:32:34 +00:00
struct timespec start;
struct timespec stop;
struct timespec delta;
2009-01-14 16:38:35 +00:00
} zpios_time_t;
2008-12-05 19:32:34 +00:00
2009-01-14 16:38:35 +00:00
typedef struct zpios_stats {
zpios_time_t total_time;
zpios_time_t cr_time;
zpios_time_t rm_time;
zpios_time_t wr_time;
zpios_time_t rd_time;
2008-12-05 19:32:34 +00:00
uint64_t wr_data;
uint64_t wr_chunks;
uint64_t rd_data;
uint64_t rd_chunks;
2009-01-14 16:38:35 +00:00
} zpios_stats_t;
2008-12-05 19:32:34 +00:00
2009-01-14 16:38:35 +00:00
#define ZPIOS_CMD_MAGIC 0x49715385U
typedef struct zpios_cmd {
2008-12-05 19:32:34 +00:00
uint32_t cmd_magic; /* Unique magic */
uint32_t cmd_id; /* Run ID */
2009-01-14 16:38:35 +00:00
char cmd_pool[ZPIOS_NAME_SIZE]; /* Pool name */
2008-12-05 19:32:34 +00:00
uint64_t cmd_chunk_size; /* Chunk size */
uint32_t cmd_thread_count; /* Thread count */
uint32_t cmd_region_count; /* Region count */
uint64_t cmd_region_size; /* Region size */
uint64_t cmd_offset; /* Region offset */
uint32_t cmd_region_noise; /* Region noise */
uint32_t cmd_chunk_noise; /* Chunk noise */
uint32_t cmd_thread_delay; /* Thread delay */
uint32_t cmd_flags; /* Test flags */
2009-01-14 16:38:35 +00:00
char cmd_pre[ZPIOS_PATH_SIZE]; /* Pre-exec hook */
char cmd_post[ZPIOS_PATH_SIZE]; /* Post-exec hook */
char cmd_log[ZPIOS_PATH_SIZE]; /* Requested log dir */
2008-12-05 19:32:34 +00:00
uint64_t cmd_data_size; /* Opaque data size */
char cmd_data_str[0]; /* Opaque data region */
2009-01-14 16:38:35 +00:00
} zpios_cmd_t;
2008-12-05 19:32:34 +00:00
/* Valid ioctls */
2009-01-14 16:38:35 +00:00
#define ZPIOS_CFG _IOWR('f', 101, long)
#define ZPIOS_CMD _IOWR('f', 102, long)
2008-12-05 19:32:34 +00:00
/* Valid configuration commands */
2009-01-14 16:38:35 +00:00
#define ZPIOS_CFG_BUFFER_CLEAR 0x001 /* Clear text buffer */
#define ZPIOS_CFG_BUFFER_SIZE 0x002 /* Resize text buffer */
2008-12-05 19:32:34 +00:00
2009-01-14 16:38:35 +00:00
#endif /* _ZPIOS_CTL_H */