?? util.h
字號:
/* * usu.c * * Author : Lionetti Salvatore <salvatorelionetti@yahoo.it> * License: GPL * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */#ifndef __UTIL_USU__#define __UTIL_USU__#include<linux/errno.h>#ifdef __KERNEL__#include<linux/kernel.h>/* <1> in printk("<1>...") is considered only on new line. * So in !new line we see <1> with dmesg. */#define PRINT printk/*int printk(char *fmt,...);*/#else/*#include<stdio.h>*/#define PRINT printf#endif#ifdef __KERNEL__#include<linux/string.h> /* To have memcpy(), memset(). *//*#include<linux/kernel.h> To have scnprintf(). */#include<asm/uaccess.h> /* To have copy_{to,from}_user()*/#define Snprintf(format, args...) if (l<len) l+=scnprintf(buf+l,len-l,format,##args); #define CopyToUser(to,from,n) copy_to_user(to,from,n)#define CopyFromUser(to,from,n) copy_from_user(to,from,n)#else#include<string.h>#include<stdio.h> /* To have snprintf(). */#define Snprintf(format, args...) if (l<len) l+=snprintf(buf+l,len-l,format,##args); #define CopyToUser(to,from,n) (memcpy(to,from,n)?0:-EFAULT)#define CopyFromUser(to,from,n) (memcpy(to,from,n)?0:-EFAULT)#endif#endif
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -