tmod.h revision 37550cf5a86c7ca7424a2a318dd64e550f13f5df
1/*
2 *
3 *   Copyright (c) International Business Machines  Corp., 2001
4 *
5 *   This program is free software;  you can redistribute it and/or modify
6 *   it under the terms of the GNU General Public License as published by
7 *   the Free Software Foundation; either version 2 of the License, or
8 *   (at your option) any later version.
9 *
10 *   This program is distributed in the hope that it will be useful,
11 *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
12 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
13 *   the 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 to the Free Software
17 *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19
20 * In this header file keep all flags and other
21 * structures that will be needed in both kernel
22 * and user space. Specifically the ioctl flags
23 * will go in here so that in user space a program
24 * can specify flags for the ioctl call.
25 *
26 * author: Sean Ruyle
27 * date:   06/11/2003
28 *
29 */
30
31#define TMOD_DRIVER_NAME	"ltp example module"
32#define DEVICE_NAME		"/dev/tmod"
33#define TMOD_MAJOR      252
34#define MAG_NUM			'k'
35#ifndef SET_MODULE_OWNER
36#define SET_MODULE_OWNER(dev) ((dev)->owner = THIS_MODULE)
37#endif
38
39/* put ioctl flags here, use the _IO macro which is
40 found in linux/ioctl.h, takes a letter, and an
41 integer */
42
43#define LTP_OPTION1		_IO(MAG_NUM, 1)
44#define LTP_OTHER		_IO(MAG_NUM, 2)
45
46/* memory between the kernel and user space is
47 seperated, so that if a structure is needed
48 to be passed between kernel and user space
49 a call must be made to copy_to_user or copy
50 from user. Use this structure to streamline
51 that process. For example: A function that
52 writes to a disc takes in a ki_write_t
53 pointer from userspace. In the user space
54 program specify the length of the pointer as
55 in_len, and in_data as the actual structure. */
56
57struct tmod_interface {
58	int     in_len;         // input data length
59        caddr_t in_data;        // input data
60        int     out_rc;         // return code from the test
61        int     out_len;        // output data length
62        caddr_t out_data;       // output data
63};
64typedef struct tmod_interface tmod_interface_t;
65
66
67
68
69
70