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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? ub.c

?? linux 內(nèi)核源代碼
?? C
?? 第 1 頁 / 共 5 頁
字號:
	int ifnum = sc->intf->cur_altsetting->desc.bInterfaceNumber;	unsigned char *p;	enum { ALLOC_SIZE = 1 };	struct usb_ctrlrequest *cr;	struct completion compl;	struct timer_list timer;	int nluns;	int rc;	init_completion(&compl);	rc = -ENOMEM;	if ((p = kmalloc(ALLOC_SIZE, GFP_KERNEL)) == NULL)		goto err_alloc;	*p = 55;	cr = &sc->work_cr;	cr->bRequestType = USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE;	cr->bRequest = US_BULK_GET_MAX_LUN;	cr->wValue = cpu_to_le16(0);	cr->wIndex = cpu_to_le16(ifnum);	cr->wLength = cpu_to_le16(1);	usb_fill_control_urb(&sc->work_urb, sc->dev, sc->recv_ctrl_pipe,	    (unsigned char*) cr, p, 1, ub_probe_urb_complete, &compl);	sc->work_urb.actual_length = 0;	sc->work_urb.error_count = 0;	sc->work_urb.status = 0;	if ((rc = usb_submit_urb(&sc->work_urb, GFP_KERNEL)) != 0)		goto err_submit;	init_timer(&timer);	timer.function = ub_probe_timeout;	timer.data = (unsigned long) &compl;	timer.expires = jiffies + UB_CTRL_TIMEOUT;	add_timer(&timer);	wait_for_completion(&compl);	del_timer_sync(&timer);	usb_kill_urb(&sc->work_urb);	if ((rc = sc->work_urb.status) < 0)		goto err_io;	if (sc->work_urb.actual_length != 1) {		nluns = 0;	} else {		if ((nluns = *p) == 55) {			nluns = 0;		} else {  			/* GetMaxLUN returns the maximum LUN number */			nluns += 1;			if (nluns > UB_MAX_LUNS)				nluns = UB_MAX_LUNS;		}	}	kfree(p);	return nluns;err_io:err_submit:	kfree(p);err_alloc:	return rc;}/* * Clear initial stalls. */static int ub_probe_clear_stall(struct ub_dev *sc, int stalled_pipe){	int endp;	struct usb_ctrlrequest *cr;	struct completion compl;	struct timer_list timer;	int rc;	init_completion(&compl);	endp = usb_pipeendpoint(stalled_pipe);	if (usb_pipein (stalled_pipe))		endp |= USB_DIR_IN;	cr = &sc->work_cr;	cr->bRequestType = USB_RECIP_ENDPOINT;	cr->bRequest = USB_REQ_CLEAR_FEATURE;	cr->wValue = cpu_to_le16(USB_ENDPOINT_HALT);	cr->wIndex = cpu_to_le16(endp);	cr->wLength = cpu_to_le16(0);	usb_fill_control_urb(&sc->work_urb, sc->dev, sc->send_ctrl_pipe,	    (unsigned char*) cr, NULL, 0, ub_probe_urb_complete, &compl);	sc->work_urb.actual_length = 0;	sc->work_urb.error_count = 0;	sc->work_urb.status = 0;	if ((rc = usb_submit_urb(&sc->work_urb, GFP_KERNEL)) != 0) {		printk(KERN_WARNING		     "%s: Unable to submit a probe clear (%d)\n", sc->name, rc);		return rc;	}	init_timer(&timer);	timer.function = ub_probe_timeout;	timer.data = (unsigned long) &compl;	timer.expires = jiffies + UB_CTRL_TIMEOUT;	add_timer(&timer);	wait_for_completion(&compl);	del_timer_sync(&timer);	usb_kill_urb(&sc->work_urb);	/* reset the endpoint toggle */	usb_settoggle(sc->dev, endp, usb_pipeout(sc->last_pipe), 0);	return 0;}/* * Get the pipe settings. */static int ub_get_pipes(struct ub_dev *sc, struct usb_device *dev,    struct usb_interface *intf){	struct usb_host_interface *altsetting = intf->cur_altsetting;	struct usb_endpoint_descriptor *ep_in = NULL;	struct usb_endpoint_descriptor *ep_out = NULL;	struct usb_endpoint_descriptor *ep;	int i;	/*	 * Find the endpoints we need.	 * We are expecting a minimum of 2 endpoints - in and out (bulk).	 * We will ignore any others.	 */	for (i = 0; i < altsetting->desc.bNumEndpoints; i++) {		ep = &altsetting->endpoint[i].desc;		/* Is it a BULK endpoint? */		if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)				== USB_ENDPOINT_XFER_BULK) {			/* BULK in or out? */			if (ep->bEndpointAddress & USB_DIR_IN) {				if (ep_in == NULL)					ep_in = ep;			} else {				if (ep_out == NULL)					ep_out = ep;			}		}	}	if (ep_in == NULL || ep_out == NULL) {		printk(KERN_NOTICE "%s: failed endpoint check\n",		    sc->name);		return -ENODEV;	}	/* Calculate and store the pipe values */	sc->send_ctrl_pipe = usb_sndctrlpipe(dev, 0);	sc->recv_ctrl_pipe = usb_rcvctrlpipe(dev, 0);	sc->send_bulk_pipe = usb_sndbulkpipe(dev,		ep_out->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);	sc->recv_bulk_pipe = usb_rcvbulkpipe(dev, 		ep_in->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK);	return 0;}/* * Probing is done in the process context, which allows us to cheat * and not to build a state machine for the discovery. */static int ub_probe(struct usb_interface *intf,    const struct usb_device_id *dev_id){	struct ub_dev *sc;	int nluns;	int rc;	int i;	if (usb_usual_check_type(dev_id, USB_US_TYPE_UB))		return -ENXIO;	rc = -ENOMEM;	if ((sc = kzalloc(sizeof(struct ub_dev), GFP_KERNEL)) == NULL)		goto err_core;	sc->lock = ub_next_lock();	INIT_LIST_HEAD(&sc->luns);	usb_init_urb(&sc->work_urb);	tasklet_init(&sc->tasklet, ub_scsi_action, (unsigned long)sc);	atomic_set(&sc->poison, 0);	INIT_WORK(&sc->reset_work, ub_reset_task);	init_waitqueue_head(&sc->reset_wait);	init_timer(&sc->work_timer);	sc->work_timer.data = (unsigned long) sc;	sc->work_timer.function = ub_urb_timeout;	ub_init_completion(&sc->work_done);	sc->work_done.done = 1;		/* A little yuk, but oh well... */	sc->dev = interface_to_usbdev(intf);	sc->intf = intf;	// sc->ifnum = intf->cur_altsetting->desc.bInterfaceNumber;	usb_set_intfdata(intf, sc);	usb_get_dev(sc->dev);	/*	 * Since we give the interface struct to the block level through	 * disk->driverfs_dev, we have to pin it. Otherwise, block_uevent	 * oopses on close after a disconnect (kernels 2.6.16 and up).	 */	usb_get_intf(sc->intf);	snprintf(sc->name, 12, DRV_NAME "(%d.%d)",	    sc->dev->bus->busnum, sc->dev->devnum);	/* XXX Verify that we can handle the device (from descriptors) */	if (ub_get_pipes(sc, sc->dev, intf) != 0)		goto err_dev_desc;	/*	 * At this point, all USB initialization is done, do upper layer.	 * We really hate halfway initialized structures, so from the	 * invariants perspective, this ub_dev is fully constructed at	 * this point.	 */	/*	 * This is needed to clear toggles. It is a problem only if we do	 * `rmmod ub && modprobe ub` without disconnects, but we like that.	 */#if 0 /* iPod Mini fails if we do this (big white iPod works) */	ub_probe_clear_stall(sc, sc->recv_bulk_pipe);	ub_probe_clear_stall(sc, sc->send_bulk_pipe);#endif	/*	 * The way this is used by the startup code is a little specific.	 * A SCSI check causes a USB stall. Our common case code sees it	 * and clears the check, after which the device is ready for use.	 * But if a check was not present, any command other than	 * TEST_UNIT_READY ends with a lockup (including REQUEST_SENSE).	 *	 * If we neglect to clear the SCSI check, the first real command fails	 * (which is the capacity readout). We clear that and retry, but why	 * causing spurious retries for no reason.	 *	 * Revalidation may start with its own TEST_UNIT_READY, but that one	 * has to succeed, so we clear checks with an additional one here.	 * In any case it's not our business how revaliadation is implemented.	 */	for (i = 0; i < 3; i++) {  /* Retries for the schwag key from KS'04 */		if ((rc = ub_sync_tur(sc, NULL)) <= 0) break;		if (rc != 0x6) break;		msleep(10);	}	nluns = 1;	for (i = 0; i < 3; i++) {		if ((rc = ub_sync_getmaxlun(sc)) < 0)			break;		if (rc != 0) {			nluns = rc;			break;		}		msleep(100);	}	for (i = 0; i < nluns; i++) {		ub_probe_lun(sc, i);	}	return 0;err_dev_desc:	usb_set_intfdata(intf, NULL);	usb_put_intf(sc->intf);	usb_put_dev(sc->dev);	kfree(sc);err_core:	return rc;}static int ub_probe_lun(struct ub_dev *sc, int lnum){	struct ub_lun *lun;	struct request_queue *q;	struct gendisk *disk;	int rc;	rc = -ENOMEM;	if ((lun = kzalloc(sizeof(struct ub_lun), GFP_KERNEL)) == NULL)		goto err_alloc;	lun->num = lnum;	rc = -ENOSR;	if ((lun->id = ub_id_get()) == -1)		goto err_id;	lun->udev = sc;	snprintf(lun->name, 16, DRV_NAME "%c(%d.%d.%d)",	    lun->id + 'a', sc->dev->bus->busnum, sc->dev->devnum, lun->num);	lun->removable = 1;		/* XXX Query this from the device */	lun->changed = 1;		/* ub_revalidate clears only */	ub_revalidate(sc, lun);	rc = -ENOMEM;	if ((disk = alloc_disk(UB_PARTS_PER_LUN)) == NULL)		goto err_diskalloc;	sprintf(disk->disk_name, DRV_NAME "%c", lun->id + 'a');	disk->major = UB_MAJOR;	disk->first_minor = lun->id * UB_PARTS_PER_LUN;	disk->fops = &ub_bd_fops;	disk->private_data = lun;	disk->driverfs_dev = &sc->intf->dev;	rc = -ENOMEM;	if ((q = blk_init_queue(ub_request_fn, sc->lock)) == NULL)		goto err_blkqinit;	disk->queue = q;	blk_queue_bounce_limit(q, BLK_BOUNCE_HIGH);	blk_queue_max_hw_segments(q, UB_MAX_REQ_SG);	blk_queue_max_phys_segments(q, UB_MAX_REQ_SG);	blk_queue_segment_boundary(q, 0xffffffff);	/* Dubious. */	blk_queue_max_sectors(q, UB_MAX_SECTORS);	blk_queue_hardsect_size(q, lun->capacity.bsize);	lun->disk = disk;	q->queuedata = lun;	list_add(&lun->link, &sc->luns);	set_capacity(disk, lun->capacity.nsec);	if (lun->removable)		disk->flags |= GENHD_FL_REMOVABLE;	add_disk(disk);	return 0;err_blkqinit:	put_disk(disk);err_diskalloc:	ub_id_put(lun->id);err_id:	kfree(lun);err_alloc:	return rc;}static void ub_disconnect(struct usb_interface *intf){	struct ub_dev *sc = usb_get_intfdata(intf);	struct ub_lun *lun;	unsigned long flags;	/*	 * Prevent ub_bd_release from pulling the rug from under us.	 * XXX This is starting to look like a kref.	 * XXX Why not to take this ref at probe time?	 */	spin_lock_irqsave(&ub_lock, flags);	sc->openc++;	spin_unlock_irqrestore(&ub_lock, flags);	/*	 * Fence stall clearnings, operations triggered by unlinkings and so on.	 * We do not attempt to unlink any URBs, because we do not trust the	 * unlink paths in HC drivers. Also, we get -84 upon disconnect anyway.	 */	atomic_set(&sc->poison, 1);	/*	 * Wait for reset to end, if any.	 */	wait_event(sc->reset_wait, !sc->reset);	/*	 * Blow away queued commands.	 *	 * Actually, this never works, because before we get here	 * the HCD terminates outstanding URB(s). It causes our	 * SCSI command queue to advance, commands fail to submit,	 * and the whole queue drains. So, we just use this code to	 * print warnings.	 */	spin_lock_irqsave(sc->lock, flags);	{		struct ub_scsi_cmd *cmd;		int cnt = 0;		while ((cmd = ub_cmdq_peek(sc)) != NULL) {			cmd->error = -ENOTCONN;			cmd->state = UB_CMDST_DONE;			ub_cmdq_pop(sc);			(*cmd->done)(sc, cmd);			cnt++;		}		if (cnt != 0) {			printk(KERN_WARNING "%s: "			    "%d was queued after shutdown\n", sc->name, cnt);		}	}	spin_unlock_irqrestore(sc->lock, flags);	/*	 * Unregister the upper layer.	 */	list_for_each_entry(lun, &sc->luns, link) {		del_gendisk(lun->disk);		/*		 * I wish I could do:		 *    set_bit(QUEUE_FLAG_DEAD, &q->queue_flags);		 * As it is, we rely on our internal poisoning and let		 * the upper levels to spin furiously failing all the I/O.		 */	}	/*	 * Testing for -EINPROGRESS is always a bug, so we are bending	 * the rules a little.	 */	spin_lock_irqsave(sc->lock, flags);	if (sc->work_urb.status == -EINPROGRESS) {	/* janitors: ignore */		printk(KERN_WARNING "%s: "		    "URB is active after disconnect\n", sc->name);	}	spin_unlock_irqrestore(sc->lock, flags);	/*	 * There is virtually no chance that other CPU runs times so long	 * after ub_urb_complete should have called del_timer, but only if HCD	 * didn't forget to deliver a callback on unlink.	 */	del_timer_sync(&sc->work_timer);	/*	 * At this point there must be no commands coming from anyone	 * and no URBs left in transit.	 */	ub_put(sc);}static struct usb_driver ub_driver = {	.name =		"ub",	.probe =	ub_probe,	.disconnect =	ub_disconnect,	.id_table =	ub_usb_ids,};static int __init ub_init(void){	int rc;	int i;	for (i = 0; i < UB_QLOCK_NUM; i++)		spin_lock_init(&ub_qlockv[i]);	if ((rc = register_blkdev(UB_MAJOR, DRV_NAME)) != 0)		goto err_regblkdev;	if ((rc = usb_register(&ub_driver)) != 0)		goto err_register;	usb_usual_set_present(USB_US_TYPE_UB);	return 0;err_register:	unregister_blkdev(UB_MAJOR, DRV_NAME);err_regblkdev:	return rc;}static void __exit ub_exit(void){	usb_deregister(&ub_driver);	unregister_blkdev(UB_MAJOR, DRV_NAME);	usb_usual_clear_present(USB_US_TYPE_UB);}module_init(ub_init);module_exit(ub_exit);MODULE_LICENSE("GPL");

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜成人免费电影| 美日韩一区二区三区| 国产一区二区成人久久免费影院| 91精品国产品国语在线不卡| 一区二区三区不卡在线观看| 欧美怡红院视频| 日韩高清在线电影| 26uuu色噜噜精品一区二区| 久久精品国产久精国产爱| 亚洲一区av在线| 欧美色精品在线视频| 日韩精品一级二级 | 夜夜精品视频一区二区 | 91在线观看视频| 一区二区三区四区高清精品免费观看| 日本高清无吗v一区| 午夜欧美在线一二页| 精品国内片67194| 成人免费va视频| 国产欧美日韩综合| 色呦呦国产精品| 香蕉成人啪国产精品视频综合网| 欧美一级片免费看| 岛国精品在线播放| 亚洲高清免费一级二级三级| 日韩视频123| 99v久久综合狠狠综合久久| 午夜伊人狠狠久久| 国产欧美一区二区三区鸳鸯浴| av电影在线观看完整版一区二区| 一区二区三区产品免费精品久久75| 欧美一区二区三区精品| 99在线精品视频| 日韩有码一区二区三区| 国产精品妹子av| 欧美一二三四在线| 97久久精品人人爽人人爽蜜臀| 美女www一区二区| 亚洲乱码国产乱码精品精98午夜 | 在线影院国内精品| 国产精品自在在线| 一级女性全黄久久生活片免费| 久久中文字幕电影| 欧美精品高清视频| 色婷婷综合激情| 粉嫩av一区二区三区粉嫩| 丝袜美腿亚洲综合| 专区另类欧美日韩| 国产日韩欧美高清在线| 在线电影欧美成精品| 91免费在线看| 国产精品99久| 天天亚洲美女在线视频| 亚洲免费av在线| 国产精品久久免费看| 欧美精品一区二区在线观看| 欧美肥胖老妇做爰| 欧美日韩免费一区二区三区视频 | 色女孩综合影院| 国产成人在线电影| 久久精品国产99国产精品| 亚洲一二三区视频在线观看| 亚洲日韩欧美一区二区在线| 欧美激情自拍偷拍| 久久久精品国产免大香伊| 精品欧美久久久| 欧美电影免费提供在线观看| 欧美精品第一页| 欧美精品v国产精品v日韩精品| 欧美视频一区在线| 91麻豆自制传媒国产之光| 成人黄色一级视频| 99热在这里有精品免费| 成人免费观看视频| 成人精品小蝌蚪| 99久久精品99国产精品| 成人激情小说网站| 99免费精品在线观看| 99久久er热在这里只有精品66| 国产成人av电影在线| 成人教育av在线| 94色蜜桃网一区二区三区| 色婷婷综合视频在线观看| 91福利国产成人精品照片| 在线视频中文字幕一区二区| 在线一区二区视频| 在线播放中文字幕一区| 日韩午夜电影av| 26uuu另类欧美| 中文字幕国产一区| 国产精品久久久久久久久图文区 | 制服丝袜日韩国产| 日韩欧美国产综合在线一区二区三区 | 91精品国产综合久久精品性色| 欧美日韩在线播放一区| 欧美顶级少妇做爰| 亚洲精品一区二区三区福利| 日韩视频不卡中文| 中文字幕精品三区| 一区二区三区在线视频观看| 亚洲va在线va天堂| 免费看欧美美女黄的网站| 国产米奇在线777精品观看| www.久久精品| 欧美日本一区二区在线观看| 精品国产sm最大网站免费看| 国产精品久久久久影院| 一区二区不卡在线视频 午夜欧美不卡在 | 国产综合色视频| 91亚洲国产成人精品一区二区三 | 久久久亚洲欧洲日产国码αv| 成人欧美一区二区三区1314| 视频一区在线播放| 粉嫩aⅴ一区二区三区四区| 在线视频一区二区三| 日韩视频在线你懂得| 国产精品国产三级国产普通话蜜臀| 亚洲影视在线播放| 国产乱理伦片在线观看夜一区| 91色综合久久久久婷婷| 精品久久国产老人久久综合| 亚洲天堂av老司机| 精品无人码麻豆乱码1区2区| 91在线视频官网| 精品国产成人在线影院| 亚洲精品免费在线观看| 国产乱码精品一区二区三区五月婷| 色呦呦国产精品| 日本一区二区免费在线观看视频| 亚洲第一福利一区| 成人黄动漫网站免费app| 日韩一区二区精品在线观看| 亚洲欧美在线高清| 国产精品亚洲一区二区三区妖精 | 亚洲精品一区二区在线观看| 亚洲黄色免费电影| 国产高清不卡一区二区| 91麻豆精品国产91久久久资源速度| 中文字幕在线不卡一区二区三区| 久久99精品久久久久久久久久久久| 色婷婷久久综合| 国产亚洲精品bt天堂精选| 日本亚洲欧美天堂免费| 在线观看亚洲成人| 国产精品萝li| 国产成人在线免费观看| 日韩精品一区二区三区四区视频 | 极品尤物av久久免费看| 精品视频999| 一区二区三区四区高清精品免费观看| 欧美一区二区三区啪啪| 亚洲一二三级电影| 一本色道综合亚洲| 国产精品久久久久国产精品日日| 精品一区二区av| 欧美刺激午夜性久久久久久久| 亚洲国产va精品久久久不卡综合| 99久久免费视频.com| 国产精品丝袜在线| 国产精品 欧美精品| 国产亚洲一区二区三区四区| 精品一区二区三区香蕉蜜桃 | 国产又粗又猛又爽又黄91精品| 欧美高清你懂得| 日精品一区二区| 7777精品伊人久久久大香线蕉经典版下载 | 欧美综合天天夜夜久久| 亚洲综合无码一区二区| 在线观看91精品国产入口| 一区二区三区免费| 欧美性欧美巨大黑白大战| 亚洲欧美精品午睡沙发| 91国偷自产一区二区开放时间 | 欧美国产97人人爽人人喊| 国产老妇另类xxxxx| 久久久久亚洲蜜桃| 丁香网亚洲国际| 亚洲特黄一级片| 色激情天天射综合网| 香蕉成人伊视频在线观看| 欧美一区二区私人影院日本| 激情综合色播激情啊| 久久亚区不卡日本| 成人精品一区二区三区四区| 中文字幕日韩一区| 在线免费av一区| 午夜不卡av免费| 日韩欧美国产一区二区三区| 国内一区二区视频| 国产精品久久久久久久午夜片 | 免费av网站大全久久| 精品久久久久久久久久久久久久久久久| 麻豆成人久久精品二区三区小说| 精品国产髙清在线看国产毛片| 丁香六月久久综合狠狠色| 亚洲精品国产精华液| 91精品国产综合久久久久久久久久 | 粗大黑人巨茎大战欧美成人| 最新久久zyz资源站| 欧美人与禽zozo性伦|