]> git.proxmox.com Git - mirror_spl-debian.git/blob - include/splat-ctl.h
b800887b8fa8117b167d74eb13d7d3d746d520bb
[mirror_spl-debian.git] / include / splat-ctl.h
1 /*****************************************************************************\
2 * Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
3 * Copyright (C) 2007 The Regents of the University of California.
4 * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
5 * Written by Brian Behlendorf <behlendorf1@llnl.gov>.
6 * UCRL-CODE-235197
7 *
8 * This file is part of the SPL, Solaris Porting Layer.
9 * For details, see <http://github.com/behlendorf/spl/>.
10 *
11 * The SPL is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 *
16 * The SPL is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19 * for more details.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with the SPL. If not, see <http://www.gnu.org/licenses/>.
23 \*****************************************************************************/
24
25 #ifndef _SPLAT_CTL_H
26 #define _SPLAT_CTL_H
27
28 #include <linux/types.h>
29
30 /*
31 * Contains shared definitions for both user space and kernel space. To
32 * ensure 32-bit/64-bit interoperability over ioctl()'s only types with
33 * fixed sizes can be used.
34 */
35 #define SPLAT_MAJOR 225 /* XXX - Arbitrary */
36 #define SPLAT_MINORS 1
37 #define SPLAT_NAME "splatctl"
38 #define SPLAT_DEV "/dev/splatctl"
39
40 #define SPLAT_NAME_SIZE 20
41 #define SPLAT_DESC_SIZE 60
42
43 typedef struct splat_user {
44 char name[SPLAT_NAME_SIZE]; /* Short name */
45 char desc[SPLAT_DESC_SIZE]; /* Short description */
46 __u32 id; /* Unique numeric id */
47 } splat_user_t;
48
49 #define SPLAT_CFG_MAGIC 0x15263748U
50 typedef struct splat_cfg {
51 __u32 cfg_magic; /* Unique magic */
52 __u32 cfg_cmd; /* Configure command */
53 __s32 cfg_arg1; /* Configure command arg 1 */
54 __s32 cfg_rc1; /* Configure response 1 */
55 union {
56 struct {
57 __u32 size;
58 splat_user_t descs[0];
59 } splat_subsystems;
60 struct {
61 __u32 size;
62 splat_user_t descs[0];
63 } splat_tests;
64 } cfg_data;
65 } splat_cfg_t;
66
67 #define SPLAT_CMD_MAGIC 0x9daebfc0U
68 typedef struct splat_cmd {
69 __u32 cmd_magic; /* Unique magic */
70 __u32 cmd_subsystem; /* Target subsystem */
71 __u32 cmd_test; /* Subsystem test */
72 __u32 cmd_data_size; /* Opaque data size */
73 char cmd_data_str[0]; /* Opaque data region */
74 } splat_cmd_t;
75
76 /* Valid ioctls */
77 #define SPLAT_CFG _IOWR('f', 101, splat_cfg_t)
78 #define SPLAT_CMD _IOWR('f', 102, splat_cmd_t)
79
80 /* Valid configuration commands */
81 #define SPLAT_CFG_BUFFER_CLEAR 0x001 /* Clear text buffer */
82 #define SPLAT_CFG_BUFFER_SIZE 0x002 /* Resize text buffer */
83 #define SPLAT_CFG_SUBSYSTEM_COUNT 0x101 /* Number of subsystem */
84 #define SPLAT_CFG_SUBSYSTEM_LIST 0x102 /* List of N subsystems */
85 #define SPLAT_CFG_TEST_COUNT 0x201 /* Number of tests */
86 #define SPLAT_CFG_TEST_LIST 0x202 /* List of N tests */
87
88 /*
89 * Valid subsystem and test commands are defined in each subsystem as
90 * SPLAT_SUBSYSTEM_*. We do need to be careful to avoid collisions, the
91 * currently defined subsystems are as follows:
92 */
93 #define SPLAT_SUBSYSTEM_KMEM 0x0100
94 #define SPLAT_SUBSYSTEM_TASKQ 0x0200
95 #define SPLAT_SUBSYSTEM_KRNG 0x0300
96 #define SPLAT_SUBSYSTEM_MUTEX 0x0400
97 #define SPLAT_SUBSYSTEM_CONDVAR 0x0500
98 #define SPLAT_SUBSYSTEM_THREAD 0x0600
99 #define SPLAT_SUBSYSTEM_RWLOCK 0x0700
100 #define SPLAT_SUBSYSTEM_TIME 0x0800
101 #define SPLAT_SUBSYSTEM_VNODE 0x0900
102 #define SPLAT_SUBSYSTEM_KOBJ 0x0a00
103 #define SPLAT_SUBSYSTEM_ATOMIC 0x0b00
104 #define SPLAT_SUBSYSTEM_LIST 0x0c00
105 #define SPLAT_SUBSYSTEM_GENERIC 0x0d00
106 #define SPLAT_SUBSYSTEM_CRED 0x0e00
107 #define SPLAT_SUBSYSTEM_ZLIB 0x0f00
108 #define SPLAT_SUBSYSTEM_LINUX 0x1000
109 #define SPLAT_SUBSYSTEM_UNKNOWN 0xff00
110
111 #endif /* _SPLAT_CTL_H */