亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? pdcraid.c

?? ep9315平臺下硬盤驅動的源碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*   pdcraid.c  Copyright (C) 2001 Red Hat, Inc. All rights reserved.   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, or (at your option)   any later version.      You should have received a copy of the GNU General Public License   (for example /usr/src/linux/COPYING); if not, write to the Free   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.        Authors: 	Arjan van de Ven <arjanv@redhat.com>   		   Based on work done by S鴕en Schmidt for FreeBSD  */#include <linux/module.h>#include <linux/init.h>#include <linux/kernel.h>#include <linux/sched.h>#include <linux/smp_lock.h>#include <linux/blkdev.h>#include <linux/blkpg.h>#include <linux/genhd.h>#include <linux/ioctl.h>#include <linux/ide.h>#include <asm/uaccess.h>#include "ataraid.h"static int pdcraid_open(struct inode * inode, struct file * filp);static int pdcraid_release(struct inode * inode, struct file * filp);static int pdcraid_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);static int pdcraid0_make_request (request_queue_t *q, int rw, struct buffer_head * bh);static int pdcraid1_make_request (request_queue_t *q, int rw, struct buffer_head * bh);struct disk_dev {	int major;	int minor;	int device;};static struct disk_dev devlist[]= {	{IDE0_MAJOR,  0,  -1 },	{IDE0_MAJOR, 64,  -1 },	{IDE1_MAJOR,  0,  -1 },	{IDE1_MAJOR, 64,  -1 },	{IDE2_MAJOR,  0,  -1 },	{IDE2_MAJOR, 64,  -1 },	{IDE3_MAJOR,  0,  -1 },	{IDE3_MAJOR, 64,  -1 },	{IDE4_MAJOR,  0,  -1 },	{IDE4_MAJOR, 64,  -1 },	{IDE5_MAJOR,  0,  -1 },	{IDE5_MAJOR, 64,  -1 },	{IDE6_MAJOR,  0,  -1 },	{IDE6_MAJOR, 64,  -1 },};struct pdcdisk {	kdev_t	device;	unsigned long sectors;	struct block_device *bdev;	unsigned long last_pos;};struct pdcraid {	unsigned int stride;	unsigned int disks;	unsigned long sectors;	struct geom geom;		struct pdcdisk disk[8];		unsigned long cutoff[8];	unsigned int cutoff_disks[8];};static struct raid_device_operations pdcraid0_ops = {        open:                   pdcraid_open,	release:                pdcraid_release,	ioctl:			pdcraid_ioctl,	make_request:		pdcraid0_make_request};static struct raid_device_operations pdcraid1_ops = {        open:                   pdcraid_open,	release:                pdcraid_release,	ioctl:			pdcraid_ioctl,	make_request:		pdcraid1_make_request};static struct pdcraid raid[16];static int pdcraid_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg){	unsigned int minor;   	unsigned long sectors;	if (!inode || !inode->i_rdev) 		return -EINVAL;	minor = MINOR(inode->i_rdev)>>SHIFT;		switch (cmd) {         	case BLKGETSIZE:   /* Return device size */ 			if (!arg)  return -EINVAL;			sectors = ataraid_gendisk.part[MINOR(inode->i_rdev)].nr_sects;			if (MINOR(inode->i_rdev)&15)				return put_user(sectors, (unsigned long *) arg);			return put_user(raid[minor].sectors , (unsigned long *) arg);			break;					case HDIO_GETGEO:		{			struct hd_geometry *loc = (struct hd_geometry *) arg;			unsigned short bios_cyl = raid[minor].geom.cylinders; /* truncate */						if (!loc) return -EINVAL;			if (put_user(raid[minor].geom.heads, (byte *) &loc->heads)) return -EFAULT;			if (put_user(raid[minor].geom.sectors, (byte *) &loc->sectors)) return -EFAULT;			if (put_user(bios_cyl, (unsigned short *) &loc->cylinders)) return -EFAULT;			if (put_user((unsigned)ataraid_gendisk.part[MINOR(inode->i_rdev)].start_sect,				(unsigned long *) &loc->start)) return -EFAULT;			return 0;		}		case HDIO_GETGEO_BIG:		{			struct hd_big_geometry *loc = (struct hd_big_geometry *) arg;			if (!loc) return -EINVAL;			if (put_user(raid[minor].geom.heads, (byte *) &loc->heads)) return -EFAULT;			if (put_user(raid[minor].geom.sectors, (byte *) &loc->sectors)) return -EFAULT;			if (put_user(raid[minor].geom.cylinders, (unsigned int *) &loc->cylinders)) return -EFAULT;			if (put_user((unsigned)ataraid_gendisk.part[MINOR(inode->i_rdev)].start_sect,				(unsigned long *) &loc->start)) return -EFAULT;			return 0;		}		default:			return blk_ioctl(inode->i_rdev, cmd, arg);	};	return 0;}static unsigned long partition_map_normal(unsigned long block, unsigned long partition_off, unsigned long partition_size, int stride){	return block + partition_off;}static int pdcraid0_make_request (request_queue_t *q, int rw, struct buffer_head * bh){	unsigned long rsect;	unsigned long rsect_left,rsect_accum = 0;	unsigned long block;	unsigned int disk=0,real_disk=0;	int i;	int device;	struct pdcraid *thisraid;	rsect = bh->b_rsector;		/* Ok. We need to modify this sector number to a new disk + new sector number. 	 * If there are disks of different sizes, this gets tricky. 	 * Example with 3 disks (1Gb, 4Gb and 5 GB):	 * The first 3 Gb of the "RAID" are evenly spread over the 3 disks.	 * Then things get interesting. The next 2Gb (RAID view) are spread across disk 2 and 3	 * and the last 1Gb is disk 3 only.	 *	 * the way this is solved is like this: We have a list of "cutoff" points where everytime	 * a disk falls out of the "higher" count, we mark the max sector. So once we pass a cutoff	 * point, we have to divide by one less.	 */		device = (bh->b_rdev >> SHIFT)&MAJOR_MASK;	thisraid = &raid[device];	if (thisraid->stride==0)		thisraid->stride=1;	/* Partitions need adding of the start sector of the partition to the requested sector */		rsect = partition_map_normal(rsect, ataraid_gendisk.part[MINOR(bh->b_rdev)].start_sect, ataraid_gendisk.part[MINOR(bh->b_rdev)].nr_sects, thisraid->stride);	/* Woops we need to split the request to avoid crossing a stride barrier */	if ((rsect/thisraid->stride) != ((rsect+(bh->b_size/512)-1)/thisraid->stride)) {		return -1;  	}		rsect_left = rsect;		for (i=0;i<8;i++) {		if (thisraid->cutoff_disks[i]==0)			break;		if (rsect > thisraid->cutoff[i]) {			/* we're in the wrong area so far */			rsect_left -= thisraid->cutoff[i];			rsect_accum += thisraid->cutoff[i]/thisraid->cutoff_disks[i];		} else {			block = rsect_left / thisraid->stride;			disk = block % thisraid->cutoff_disks[i];			block = (block / thisraid->cutoff_disks[i]) * thisraid->stride;			rsect = rsect_accum + (rsect_left % thisraid->stride) + block;			break;		}	}		for (i=0;i<8;i++) {		if ((disk==0) && (thisraid->disk[i].sectors > rsect_accum)) {			real_disk = i;			break;		}		if ((disk>0) && (thisraid->disk[i].sectors >= rsect_accum)) {			disk--;		}			}	disk = real_disk;				/*	 * The new BH_Lock semantics in ll_rw_blk.c guarantee that this	 * is the only IO operation happening on this bh.	 */	bh->b_rdev = thisraid->disk[disk].device;	bh->b_rsector = rsect;	/*	 * Let the main block layer submit the IO and resolve recursion:	 */	return 1;}static int pdcraid1_write_request(request_queue_t *q, int rw, struct buffer_head * bh){	struct buffer_head *bh1;	struct ataraid_bh_private *private;	int device;	int i;	device = (bh->b_rdev >> SHIFT)&MAJOR_MASK;	private = ataraid_get_private();	if (private==NULL)		BUG();	private->parent = bh;		atomic_set(&private->count,raid[device].disks);	for (i = 0; i< raid[device].disks; i++) { 		bh1=ataraid_get_bhead();		/* If this ever fails we're doomed */		if (!bh1)			BUG();			/* dupe the bufferhead and update the parts that need to be different */		memcpy(bh1, bh, sizeof(*bh));				bh1->b_end_io = ataraid_end_request;		bh1->b_private = private;		bh1->b_rsector += ataraid_gendisk.part[MINOR(bh->b_rdev)].start_sect; /* partition offset */		bh1->b_rdev = raid[device].disk[i].device;		/* update the last known head position for the drive */		raid[device].disk[i].last_pos = bh1->b_rsector+(bh1->b_size>>9);		generic_make_request(rw,bh1);	}	return 0;}static int pdcraid1_read_request (request_queue_t *q, int rw, struct buffer_head * bh){	int device;	int dist;	int bestsofar,bestdist,i;	static int previous;	/* Reads are simple in principle. Pick a disk and go. 	   Initially I cheat by just picking the one which the last known	   head position is closest by.	   Later on, online/offline checking and performance needs adding */		device = (bh->b_rdev >> SHIFT)&MAJOR_MASK;	bh->b_rsector += ataraid_gendisk.part[MINOR(bh->b_rdev)].start_sect;	bestsofar = 0; 	bestdist = raid[device].disk[0].last_pos - bh->b_rsector;	if (bestdist<0) 		bestdist=-bestdist;	if (bestdist>4095)		bestdist=4095;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
中文乱码免费一区二区| 一个色妞综合视频在线观看| 欧美成人伊人久久综合网| 91精品办公室少妇高潮对白| 欧美伊人精品成人久久综合97| 欧美精品精品一区| 91精品国产欧美一区二区成人| 精品久久久久久久人人人人传媒 | 中文字幕乱码亚洲精品一区| 亚洲午夜三级在线| 国产成人综合视频| 欧美理论电影在线| 最新成人av在线| 久久99精品国产| 欧美色综合影院| 综合久久综合久久| 懂色av一区二区三区蜜臀| 欧美一区二区成人6969| 一区二区三区在线视频播放| 成人精品小蝌蚪| 2020国产成人综合网| 日本欧美肥老太交大片| 精品视频999| 亚洲综合精品自拍| 色综合中文字幕国产 | 色综合久久久久综合体| 久久精品在线免费观看| 日韩1区2区3区| 精品视频全国免费看| 一级精品视频在线观看宜春院| av一二三不卡影片| 中文字幕电影一区| 成人av在线观| 国产精品国产三级国产专播品爱网| 国产最新精品免费| 精品精品国产高清a毛片牛牛 | 亚洲精品国产视频| 一本久久综合亚洲鲁鲁五月天 | 日韩一区二区三区精品视频| 婷婷成人综合网| 欧美精品成人一区二区三区四区| 亚洲线精品一区二区三区| 日本久久电影网| 依依成人精品视频| 色综合久久久久综合体桃花网| 国产精品高清亚洲| 色婷婷av一区二区三区之一色屋| 亚洲免费在线视频| 欧美日韩中字一区| 亚洲免费高清视频在线| 国产精品亚洲一区二区三区妖精| 成人免费视频视频在线观看免费| 26uuu久久天堂性欧美| 91精品国产一区二区三区蜜臀| 91精品国产综合久久蜜臀| 日韩一区二区精品葵司在线| 日韩免费一区二区三区在线播放| 日韩精品一区二区三区在线 | 中文字幕一区二区三区不卡在线| 亚洲最色的网站| 首页欧美精品中文字幕| 欧美一区午夜精品| 国产高清不卡二三区| 国产精品久久久久天堂| 在线看一区二区| 日本va欧美va精品发布| 国产喂奶挤奶一区二区三区| 一本久久综合亚洲鲁鲁五月天| 亚洲r级在线视频| 2020国产成人综合网| 91美女片黄在线观看91美女| 午夜电影网一区| 久久久五月婷婷| 91国在线观看| 九九视频精品免费| 亚洲美女视频在线| 欧美成人女星排名| 972aa.com艺术欧美| 美女精品一区二区| 中文字幕在线一区二区三区| 欧美精品视频www在线观看| 国内偷窥港台综合视频在线播放| 亚洲视频免费在线观看| 日韩一级免费一区| 色诱亚洲精品久久久久久| 久草在线在线精品观看| 亚洲一区在线视频| 国产区在线观看成人精品| 在线成人午夜影院| 成人国产视频在线观看| 国产精品视频在线看| 一本到不卡免费一区二区| 亚洲国产一二三| 国产亚洲一区字幕| 91精品国产aⅴ一区二区| 97久久超碰国产精品| 开心九九激情九九欧美日韩精美视频电影| 欧美激情一区二区三区| 欧美一区二区三区的| 色综合 综合色| 99久精品国产| 国产乱码一区二区三区| 日韩电影网1区2区| 亚洲国产视频网站| 亚洲人妖av一区二区| 国产午夜三级一区二区三| 69p69国产精品| 91黄色免费网站| 91在线观看免费视频| 国产69精品久久久久毛片| 久久电影网站中文字幕| 日产国产欧美视频一区精品| 亚洲国产精品久久久久秋霞影院| 亚洲欧美一区二区三区极速播放| 欧美国产日本韩| 国产欧美一二三区| 久久精品免费在线观看| 久久久久久麻豆| 久久精品夜色噜噜亚洲a∨| 亚洲精品一区二区三区蜜桃下载 | 久久精品国产99久久6| 青青草97国产精品免费观看| 午夜视黄欧洲亚洲| 视频一区免费在线观看| 午夜视频一区二区三区| 青草国产精品久久久久久| 青青草97国产精品免费观看 | 337p亚洲精品色噜噜| 欧美日韩中文字幕一区| 欧美精品一二三| 337p亚洲精品色噜噜| 精品入口麻豆88视频| 精品国产免费一区二区三区香蕉| 日韩欧美一级二级三级久久久| 日韩美女主播在线视频一区二区三区| 欧美一级专区免费大片| 欧美日韩中文字幕一区二区| 欧美日韩精品一区二区天天拍小说| 美女网站一区二区| 久久精品国产99国产精品| 香蕉久久一区二区不卡无毒影院| 亚洲综合色婷婷| 一区二区三区在线视频观看58 | 日韩女优av电影| 激情综合网av| 欧美一区二区黄| 亚洲欧美日韩国产一区二区三区| 国产午夜精品一区二区三区视频 | 日韩视频免费观看高清完整版| 五月综合激情网| 成人午夜激情视频| 国产精品18久久久久| 亚洲3atv精品一区二区三区| 日韩综合在线视频| 国产精品资源在线观看| 91在线免费看| 精品视频1区2区| 亚洲高清视频的网址| 久久精品国产色蜜蜜麻豆| 激情图片小说一区| 日韩视频免费观看高清在线视频| 91精品免费在线观看| 亚洲精品写真福利| 91伊人久久大香线蕉| 中文字幕成人在线观看| 麻豆成人91精品二区三区| 欧美一区二区三区在线视频| 亚洲成年人影院| 成人高清av在线| 久久综合狠狠综合久久综合88| 青娱乐精品在线视频| 欧美电影免费观看高清完整版| 国产精品家庭影院| 国产成人亚洲精品青草天美| 欧美一级日韩一级| 免费日本视频一区| 欧美日韩情趣电影| 国产自产高清不卡| 欧美一区二区三区在线视频| 天堂久久一区二区三区| 色噜噜狠狠色综合欧洲selulu| 久久青草国产手机看片福利盒子| 亚洲成人免费观看| 欧美女孩性生活视频| 日韩国产欧美在线视频| 欧美性淫爽ww久久久久无| 性久久久久久久久久久久| 精品国产一区二区亚洲人成毛片 | 婷婷国产v国产偷v亚洲高清| 欧美在线色视频| 久久国产精品72免费观看| 欧美人伦禁忌dvd放荡欲情| 国产 日韩 欧美大片| 亚洲午夜在线电影| 欧美大片国产精品| 久久精品99国产精品| 性欧美疯狂xxxxbbbb| 日韩精品成人一区二区在线| 亚洲欧美日韩国产手机在线| 国产人久久人人人人爽|