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

📄 driver_mgr.c

📁 newos is new operation system
💻 C
字号:
/* ** Copyright 2002, Thomas Kurschel. All rights reserved.** Distributed under the terms of the NewOS License.*/#include <kernel/kernel.h>#include <kernel/heap.h>#include <kernel/debug.h>#include "scsi_periph_int.h"cam_periph_interface periph_interface = {	(void (*)( cam_periph_cookie, int, int, int, 		int, const void *, int ))					scsi_async};int scsi_register_driver( scsi_periph_callbacks *callbacks, 	periph_cookie periph_cookie, scsi_driver_info **driver_out ){	scsi_driver_info *driver;		SHOW_FLOW0( 3, "" );		driver = kmalloc( sizeof( *driver ));	if( driver == NULL )		return ERR_NO_MEMORY;			driver->callbacks = callbacks;	driver->periph_cookie = periph_cookie;	driver->devices = NULL;		driver->xpt_cookie = xpt->register_driver( &periph_interface, 		(cam_periph_cookie)driver );	if( driver->xpt_cookie == NULL ) {		kfree( driver );		return ERR_NO_MEMORY;	}		SHOW_FLOW0( 3, "1" );		*driver_out = driver;		return NO_ERROR;}int scsi_unregister_driver( scsi_driver_info *driver ){	int res;		if( driver->devices )		panic( "Tried to unregister driver with active devices\n" );			if( (res = xpt->unregister_driver( driver->xpt_cookie )) != NO_ERROR )		return res;			kfree( driver );		return NO_ERROR;}

⌨️ 快捷键说明

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