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