📄 trv_def.h
字号:
/*********************************************************************** * * (C) Copyright 2000 * Jean-Jacques Germond, Fr閐閞ic Soulier, Christian Batt; Alcatel * C/O jjg@sxb.bsf.alcatel.fr * * All rights reserved. * * This code is free software; you can redistribute it and/or * modify it under the terms of the GNU *Library* General Public License * as published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This code is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * *Library* General Public License for more details. * * You should have received a copy of the GNU *Library* General Public * License along with this program (see file COPYING.LIB); if not, * write to the Free Software Foundation, Inc., 675 Mass Ave, * Cambridge, MA 02139, USA. * ***********************************************************************//* * * The "TRIVIAL DRIVER" (trv) project main include file * by Jean-Jacques Germond (jjg). * * Several parts of these source siles are derived from * Alessandro Rubini (AR) "LINUX DEVICE DRIVERS" excellent book. * and "scull" examples at ftp://ora.com/pub/examples/linux/drivers * */#ifndef TRIVIAL_DRIVER_DEF#define TRIVIAL_DRIVER_DEF#define TRV_MAX_CHARS 100#define TRV_MAJOR 120#define TRV_MAX_DEVICES 4#ifdef __KERNEL__/* Definitions that are not exported to UNIX processes */#include <linux/types.h> /* used later in this header */#include "linux/module.h"#include "linux/mm.h"#include "linux/fs.h"extern void* kmalloc(size_t, int);extern void kfree(const void *);#define NUM(dev) (MINOR(dev)) /* low nibble *//* A TRV device */typedef struct { int size; /* The buffer size (at the moment a constant) */ int nbchars; /* The number of chars in the buffer */ char* buffer; /* Where the data are in the kernel space */} Trv_Dev;extern int trv_nr_devs; /* The # of devices */extern Trv_Dev* trv_devices; /* The array of device descriptor */extern void trv_proc_register(void);extern void trv_proc_unregister(void);extern int trv_copy_from_user(void *to, const void *from, unsigned long n);extern int trv_copy_to_user (void *to, const void *from, unsigned long n);#endif#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -