• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) International Business Machines  Corp., 2001
3  * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of
8  * the License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it would be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write the Free Software Foundation,
17  * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  *
19  * In this header file keep all flags and other
20  * structures that will be needed in both kernel
21  * and user space. Specifically the ioctl flags
22  * will go in here so that in user space a program
23  * can specify flags for the ioctl call.
24  *
25  *  HISTORY     :
26  *      11/19/2003 Kai Zhao (ltcd3@cn.ibm.com)
27  *
28  *  CODE COVERAGE: 74.9% - fs/bio.c (Total Coverage)
29  *
30  */
31 
32 #define TMOD_DRIVER_NAME	"ltp test block I/O layer module"
33 #define TBIO_DEVICE_NAME	"ltp_tbio"
34 #define DEVICE_NAME		"/dev/tbio"
35 #define MAG_NUM			'k'
36 int TBIO_MAJOR;
37 
38 #define TBIO_TO_DEV              1
39 #define TBIO_FROM_DEV            2
40 
41 /* put ioctl flags here, use the _IO macro which is
42  found in linux/ioctl.h, takes a letter, and an
43  integer */
44 
45 #define LTP_TBIO_CLONE		_IO(MAG_NUM,1)
46 #define LTP_TBIO_ALLOC		_IO(MAG_NUM,2)
47 #define LTP_TBIO_GET_NR_VECS	_IO(MAG_NUM,3)
48 #define LTP_TBIO_PUT		_IO(MAG_NUM,4)
49 #define LTP_TBIO_SPLIT		_IO(MAG_NUM,5)
50 #define LTP_TBIO_DO_IO		_IO(MAG_NUM,6)
51 #define LTP_TBIO_ADD_PAGE	_IO(MAG_NUM,7)
52 
53 /* memory between the kernel and user space is
54  seperated, so that if a structure is needed
55  to be passed between kernel and user space
56  a call must be made to copy_to_user or copy
57  from user. Use this structure to streamline
58  that process. For example: A function that
59  writes to a disc takes in a ki_write_t
60  pointer from userspace. In the user space
61  program specify the length of the pointer as
62  in_len, and in_data as the actual structure. */
63 
64 struct tbio_interface {
65 	void *data;	/* input data */
66 	int data_len;	/* input data length */
67 	int direction;	/* read or write form DEV */
68 	char *cmd;	/* read or write */
69 	unsigned short cmd_len;	/* length of cmd */
70 };
71 typedef struct tbio_interface tbio_interface_t;
72