00001 // _Id: sysdassgn.c,v 1.8 2009-05-09 13:31:09 roart Exp $ 00002 // _Locker: $ 00003 00004 // Author. Roar Thronęs. 00005 /** 00006 \file sysdassgn.c 00007 \brief QIO deassign channel - TODO still more doc 00008 \author Roar Thronęs 00009 */ 00010 00011 #include<starlet.h> 00012 #include<iodef.h> 00013 #include<ssdef.h> 00014 #include<irpdef.h> 00015 #include<ucbdef.h> 00016 #include<ccbdef.h> 00017 #include<system_data_cells.h> 00018 #include<linux/vmalloc.h> 00019 #include<linux/linkage.h> 00020 #include <exe_routines.h> 00021 #include <ioc_routines.h> 00022 #include <sch_routines.h> 00023 00024 /** 00025 \brief deassign channel 00026 \param chan i/o channel 00027 */ 00028 00029 asmlinkage int exe_dassgn(unsigned short int chan) { 00030 struct _ccb * ccb; 00031 /** verify i/o channel */ 00032 int sts = ioc_verify_chan(chan, &ccb); 00033 if ((sts & 1) == 0) 00034 return sts; 00035 /** call exe_canceln, but not implemented, do $cancel instead */ 00036 // cancel is according to the book going to get the code, but how? 00037 sts = exe_cancel(chan /*, 0 CAN$C_DASSGN*/); // does not read param 00038 /** call verify_chan again, in case of asts - MISSING */ 00039 /** check ccb_l_wind and close the file - MISSING */ 00040 /** check ccb_w_ioc to see if outstanding i/o - MISSING */ 00041 /** lock i/o db */ 00042 sch_iolockw(); 00043 /** clear ccb amod */ 00044 ccb->ccb_b_amod=0; 00045 /** disassociate eventual mailbox - MISSING */ 00046 /** dec ucb ref count */ 00047 ccb->ccb_l_ucb->ucb$l_refc--; 00048 /** checks and stuff to do if refc == 0 - MISSING */ 00049 /** eventually do ioc_last_chan - MISSING */ 00050 /** i/o db unlock */ 00051 sch_iounlock(); 00052 return SS__NORMAL; 00053 } 00054 00055 00056