⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bc_dev.h

📁 加密解密,安全工具!很有意思的代码
💻 H
字号:
/******************************************************************* *	Copyright (c) 1994-1998 Jetico, Inc., Finland *	All rights reserved. * *	File:		driver/bc.h * *	Description:	device structure * *	Scope:		BestCrypt pseudo-device driver * *	Platforms:	Linux * *	Author:		Nail R. Kaipov * *	Created:	10-Nov-1998 * *	Revision:	21-Mar-2000.	cleaning up (v0.4b-2) *			07-Feb-2001.	unified for 2.2.x & 2.4.x * *******************************************************************/#ifndef __BC__#define __BC__#ifdef __KERNEL__/* bc device description */struct bc_device {	int			bc_number;	/* number of device  */	int			bc_refcnt;	/* references count  */	loff_t			bc_offset;	/* master offset     */	loff_t			bc_start_sector;/* starting sector   */	loff_t			bc_num_sectors;	/* data	size         */	KEY_HANDLE		bc_key;		/* key handle        */	struct bc_algorithm	*bc_alg;	/* encryption algo   */	struct file		*bc_file;	/* mounted container */	struct dentry		*bc_dentry;	/* bc special dentry */	struct semaphore	bc_control;	/* ioctl control     */	int			bc_activity;	/* monitor disk r/w  */#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) && LINUX_VERSION_CODE <= KERNEL_VERSION(2,7,0))	dev_t			bc_dev;		/* real device       */	atomic_t		bc_pending;	/* # of pending bios	*/	spinlock_t		bc_lock;	/* bc access lock	*/	struct semaphore	bc_thread;	/* start/stop thread	*/	struct semaphore	bc_run;		/* worker thread signal	*/	unsigned char		*bc_buffer;	/* buffer for write op	*/	struct gendisk		*bc_gendisk;	/* underlying gendisk	*/	int			bc_gfpmask;	/* save inode GFP mask	*/	struct bio		*bc_biohead;	/* pending request bios	*/	struct bio		*bc_biotail;	/* pending request bios	*/	request_queue_t		bc_queue;	/* per-device req queue	*/	int			(*bc_process_bio)(struct bc_device *bc, struct bio *bio);#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) && LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0))	kdev_t			bc_dev;		/* real device       */	atomic_t		bc_pending;	/* number of pending */	spinlock_t		bc_lock;	/* bc access lock    */	devfs_handle_t		bc_hdevfs;	/* dev devfs handle  */	struct semaphore	bc_thread;	/* start/stop thread */	struct semaphore	bc_run;		/* thread workload   */	struct buffer_head	*bc_bh;		/* buffer list head  */	struct buffer_head	*bc_bhtail;	/* buffer list tail  */	unsigned char		*bc_buffer;	/* write buffer      */	int			bc_gfpmask;#else	kdev_t			bc_dev;		/* real device       */#endif	struct file_operations	bc_fops;	struct file_operations  *bc_save_fops;	struct bc_device_flags {		unsigned	active     : 1; /* serves requests    */		unsigned	busy       : 1; /* rescan in progress */		unsigned	readonly   : 1; /* read only          */		unsigned	multpart   : 1; /* partition check    */		unsigned	iv_64bit   : 1; /* full 64-bit IV     */		unsigned	mounted    : 1; /* 2.6 mounted&locked */		unsigned	configured : 1; /* 2.6 configured     */		unsigned	reserved   : 25;	}			 bc_flags;};struct bc_disk {	int			bd_number;	/* disk number = real minor  */	int			bd_refcnt;	/* references count          */	loff_t			bd_offset;	/* disk offset               */	struct bc_disk_flags {		unsigned	configured : 1;	/* disk configured           */		unsigned	mounted    : 1; /* device mounted and locked */		unsigned	reserved   : 30;	}			bd_flags;};#define DEVICE_CONF	"bc.conf"#define DEVICE_STAT	"bc.stat"#define DEFAULT_BC_DEVICES	16#define DEFAULT_BC_PARTITIONS	1#define MAX_MINORS		256#if   ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,37)))#define MAJOR_NR	0x07#define DEVICE_NAME	"loop"extern struct file_operations *get_blkfops(int);#define BC_BUFFERS	NR_REQUEST/4#define BC_BUFFER_SIZE	4096#elif ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,2)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)))#define MAJOR_NR	0xBC#define DEVICE_NAME	"bcrypt"#define BC_BUFFER_SIZE	4096#elif ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,7,0)))#define MAJOR_NR	0xBC#define DEVICE_NAME	"bcrypt"#define BC_BUFFER_SIZE	PAGE_SIZE#else#error BestCrypt should not work on this kernel#endif#define BC_HANDLER(dbg, x, y)   case (x): /*printk(dbg "\n"); */\				error = (y); \				break;#define BC_GET_ARG(arg, query)  if (NULL == (arg)) return -EINVAL; \                                if (copy_from_user(&(query), arg, sizeof(query))) \					return -EFAULT;									#endif /* __KERNEL__ */#endif /* __BC__ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -