patch-2.4.8 linux/drivers/s390/char/tapeblock.c
Next file: linux/drivers/s390/char/tapeblock.h
Previous file: linux/drivers/s390/char/tape3590.h
Back to the patch index
Back to the overall index
- Lines: 625
- Date:
Wed Jul 25 14:12:02 2001
- Orig file:
v2.4.7/linux/drivers/s390/char/tapeblock.c
- Orig date:
Thu Apr 12 12:16:35 2001
diff -u --recursive --new-file v2.4.7/linux/drivers/s390/char/tapeblock.c linux/drivers/s390/char/tapeblock.c
@@ -56,29 +56,29 @@
#ifdef CONFIG_DEVFS_FS
void
-tapeblock_mkdevfstree (tape_info_t* tape) {
- tape->devfs_block_dir=devfs_mk_dir (tape->devfs_dir, "block", tape);
- tape->devfs_disc=devfs_register(tape->devfs_block_dir, "disc",DEVFS_FL_DEFAULT,
- tapeblock_major, tape->blk_minor,
- TAPEBLOCK_DEFAULTMODE, &tapeblock_fops, tape);
+tapeblock_mkdevfstree (tape_info_t* ti) {
+ ti->devfs_block_dir=devfs_mk_dir (ti->devfs_dir, "block", ti);
+ ti->devfs_disc=devfs_register(ti->devfs_block_dir, "disc",DEVFS_FL_DEFAULT,
+ tapeblock_major, ti->blk_minor,
+ TAPEBLOCK_DEFAULTMODE, &tapeblock_fops, ti);
}
void
-tapeblock_rmdevfstree (tape_info_t* tape) {
- devfs_unregister(tape->devfs_disc);
- devfs_unregister(tape->devfs_block_dir);
+tapeblock_rmdevfstree (tape_info_t* ti) {
+ devfs_unregister(ti->devfs_disc);
+ devfs_unregister(ti->devfs_block_dir);
}
#endif
void
-tapeblock_setup(tape_info_t* tape) {
- blk_size[tapeblock_major][tape->blk_minor]=0; // this will be detected
- blksize_size[tapeblock_major][tape->blk_minor]=2048; // blocks are 2k by default.
- hardsect_size[tapeblock_major][tape->blk_minor]=512;
- blk_init_queue (&tape->request_queue, tape_request_fn);
- blk_queue_headactive (&tape->request_queue, 0);
+tapeblock_setup(tape_info_t* ti) {
+ blk_size[tapeblock_major][ti->blk_minor]=0; // this will be detected
+ blksize_size[tapeblock_major][ti->blk_minor]=2048; // blocks are 2k by default.
+ hardsect_size[tapeblock_major][ti->blk_minor]=512;
+ blk_init_queue (&ti->request_queue, tape_request_fn);
+ blk_queue_headactive (&ti->request_queue, 0);
#ifdef CONFIG_DEVFS_FS
- tapeblock_mkdevfstree(tape);
+ tapeblock_mkdevfstree(ti);
#endif
}
@@ -86,7 +86,7 @@
tapeblock_init(void) {
int result;
tape_frontend_t* blkfront,*temp;
- tape_info_t* tape;
+ tape_info_t* ti;
tape_init();
/* Register the tape major number to the kernel */
@@ -127,10 +127,10 @@
temp=temp->next;
temp->next=blkfront;
}
- tape=first_tape_info;
- while (tape!=NULL) {
- tapeblock_setup(tape);
- tape=tape->next;
+ ti=first_tape_info;
+ while (ti!=NULL) {
+ tapeblock_setup(ti);
+ ti=ti->next;
}
return 0;
}
@@ -171,7 +171,12 @@
s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
rc=tapeblock_mediumdetect(ti);
- if (rc) return rc; // in case of errors, we don't have a size of the medium
+ if (rc) {
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ tapestate_set (ti, TS_UNUSED);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
+ return rc; // in case of errors, we don't have a size of the medium
+ }
dev = MKDEV (tapeblock_major, MINOR (inode->i_rdev)); /* Get the device */
s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
ti->blk_filp = filp;
@@ -224,171 +229,171 @@
}
static void
-tapeblock_end_request(tape_info_t* tape) {
+tapeblock_end_request(tape_info_t* ti) {
struct buffer_head *bh;
int uptodate;
- if ((tapestate_get(tape)!=TS_FAILED) &&
- (tapestate_get(tape)!=TS_DONE))
+ if ((tapestate_get(ti)!=TS_FAILED) &&
+ (tapestate_get(ti)!=TS_DONE))
BUG(); // A request has to be completed to end it
- uptodate=(tapestate_get(tape)==TS_DONE); // is the buffer up to date?
+ uptodate=(tapestate_get(ti)==TS_DONE); // is the buffer up to date?
#ifdef TAPE_DEBUG
if (uptodate) {
debug_text_event (tape_debug_area,6,"b:done:");
- debug_int_event (tape_debug_area,6,(long)tape->cqr);
+ debug_int_event (tape_debug_area,6,(long)ti->cqr);
} else {
debug_text_event (tape_debug_area,3,"b:failed:");
- debug_int_event (tape_debug_area,3,(long)tape->cqr);
+ debug_int_event (tape_debug_area,3,(long)ti->cqr);
}
#endif
// now inform ll_rw_block about a request status
- while ((bh = tape->current_request->bh) != NULL) {
- tape->current_request->bh = bh->b_reqnext;
+ while ((bh = ti->current_request->bh) != NULL) {
+ ti->current_request->bh = bh->b_reqnext;
bh->b_reqnext = NULL;
bh->b_end_io (bh, uptodate);
}
- if (!end_that_request_first (tape->current_request, uptodate, "tBLK")) {
+ if (!end_that_request_first (ti->current_request, uptodate, "tBLK")) {
#ifndef DEVICE_NO_RANDOM
- add_blkdev_randomness (MAJOR (tape->current_request->rq_dev));
+ add_blkdev_randomness (MAJOR (ti->current_request->rq_dev));
#endif
- end_that_request_last (tape->current_request);
+ end_that_request_last (ti->current_request);
}
- tape->discipline->free_bread(tape->cqr,tape);
- tape->cqr=NULL;
- tape->current_request=NULL;
- if (tapestate_get(tape)!=TS_NOT_OPER) tapestate_set(tape,TS_IDLE);
+ ti->discipline->free_bread(ti->cqr,ti);
+ ti->cqr=NULL;
+ ti->current_request=NULL;
+ if (tapestate_get(ti)!=TS_NOT_OPER) tapestate_set(ti,TS_IDLE);
return;
}
static void
-tapeblock_exec_IO (tape_info_t* tape) {
+tapeblock_exec_IO (tape_info_t* ti) {
int rc;
struct request* req;
- if (tape->cqr) { // process done/failed request
- while ((tapestate_get(tape)==TS_FAILED) &&
- tape->blk_retries>0) {
- tape->blk_retries--;
- tape->position=-1;
- tapestate_set(tape,TS_BLOCK_INIT);
+ if (ti->cqr) { // process done/failed request
+ while ((tapestate_get(ti)==TS_FAILED) &&
+ ti->blk_retries>0) {
+ ti->blk_retries--;
+ ti->position=-1;
+ tapestate_set(ti,TS_BLOCK_INIT);
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,3,"b:retryreq:");
- debug_int_event (tape_debug_area,3,(long)tape->cqr);
+ debug_int_event (tape_debug_area,3,(long)ti->cqr);
#endif
- rc = do_IO (tape->devinfo.irq, tape->cqr->cpaddr, (unsigned long) tape->cqr,
- 0x00, tape->cqr->options);
+ rc = do_IO (ti->devinfo.irq, ti->cqr->cpaddr, (unsigned long) ti->cqr,
+ 0x00, ti->cqr->options);
if (rc) {
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,3,"b:doIOfail:");
- debug_int_event (tape_debug_area,3,(long)tape->cqr);
+ debug_int_event (tape_debug_area,3,(long)ti->cqr);
#endif
continue; // one retry lost 'cause doIO failed
}
return;
}
- tapeblock_end_request (tape); // check state, inform user, free mem, dev=idl
+ tapeblock_end_request (ti); // check state, inform user, free mem, dev=idl
}
- if (tape->cqr!=NULL) BUG(); // tape should be idle now, request should be freed!
- if (tapestate_get (tape) == TS_NOT_OPER) {
- tape->blk_minor=tape->rew_minor=tape->nor_minor=-1;
- tape->devinfo.irq=-1;
+ if (ti->cqr!=NULL) BUG(); // tape should be idle now, request should be freed!
+ if (tapestate_get (ti) == TS_NOT_OPER) {
+ ti->blk_minor=ti->rew_minor=ti->nor_minor=-1;
+ ti->devinfo.irq=-1;
return;
}
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,3,98))
- if (list_empty (&tape->request_queue.queue_head)) {
+ if (list_empty (&ti->request_queue.queue_head)) {
#else
- if (tape->request_queue==NULL) {
+ if (ti->request_queue==NULL) {
#endif
// nothing more to do or device has dissapeared;)
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"b:Qempty");
#endif
- tapestate_set(tape,TS_IDLE);
+ tapestate_set(ti,TS_IDLE);
return;
}
// queue is not empty, fetch a request and start IO!
- req=tape->current_request=tape_next_request(&tape->request_queue);
+ req=ti->current_request=tape_next_request(&ti->request_queue);
if (req==NULL) {
BUG(); // Yo. The queue was not reported empy, but no request found. This is _bad_.
}
if (req->cmd!=READ) { // we only support reading
- tapestate_set(tape,TS_FAILED);
- tapeblock_end_request (tape); // check state, inform user, free mem, dev=idl
- tapestate_set(tape,TS_BLOCK_INIT);
- schedule_tapeblock_exec_IO(tape);
+ tapestate_set(ti,TS_FAILED);
+ tapeblock_end_request (ti); // check state, inform user, free mem, dev=idl
+ tapestate_set(ti,TS_BLOCK_INIT);
+ schedule_tapeblock_exec_IO(ti);
return;
}
- tape->cqr=tape->discipline->bread(req,tape,tapeblock_major); //build channel program from request
- if (!tape->cqr) {
+ ti->cqr=ti->discipline->bread(req,ti,tapeblock_major); //build channel program from request
+ if (!ti->cqr) {
// ccw generation failed. we try again later.
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,3,"b:cqrNULL");
#endif
- schedule_tapeblock_exec_IO(tape);
- tape->current_request=NULL;
+ schedule_tapeblock_exec_IO(ti);
+ ti->current_request=NULL;
return;
}
- tape->blk_retries = TAPEBLOCK_RETRIES;
- rc= do_IO (tape->devinfo.irq, tape->cqr->cpaddr,
- (unsigned long) tape->cqr, 0x00, tape->cqr->options);
+ ti->blk_retries = TAPEBLOCK_RETRIES;
+ rc= do_IO (ti->devinfo.irq, ti->cqr->cpaddr,
+ (unsigned long) ti->cqr, 0x00, ti->cqr->options);
if (rc) {
// okay. ssch failed. we try later.
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,3,"b:doIOfail");
#endif
- tape->discipline->free_bread(tape->cqr,tape);
- tape->cqr=NULL;
- tape->current_request=NULL;
- schedule_tapeblock_exec_IO(tape);
+ ti->discipline->free_bread(ti->cqr,ti);
+ ti->cqr=NULL;
+ ti->current_request=NULL;
+ schedule_tapeblock_exec_IO(ti);
return;
}
// our request is in IO. we remove it from the queue and exit
- tape_dequeue_request (&tape->request_queue,req);
+ tape_dequeue_request (&ti->request_queue,req);
}
static void
do_tape_request (request_queue_t * queue) {
- tape_info_t* tape;
+ tape_info_t* ti;
long lockflags;
- for (tape=first_tape_info;
- ((tape!=NULL) && ((&tape->request_queue)!=queue));
- tape=tape->next);
- if (tape==NULL) BUG();
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- if (tapestate_get(tape)!=TS_IDLE) {
- s390irq_spin_unlock_irqrestore(tape->devinfo.irq,lockflags);
+ for (ti=first_tape_info;
+ ((ti!=NULL) && ((&ti->request_queue)!=queue));
+ ti=ti->next);
+ if (ti==NULL) BUG();
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ if (tapestate_get(ti)!=TS_IDLE) {
+ s390irq_spin_unlock_irqrestore(ti->devinfo.irq,lockflags);
return;
}
- if (tapestate_get(tape)!=TS_IDLE) BUG();
- tapestate_set(tape,TS_BLOCK_INIT);
- tapeblock_exec_IO(tape);
- s390irq_spin_unlock_irqrestore(tape->devinfo.irq,lockflags);
+ if (tapestate_get(ti)!=TS_IDLE) BUG();
+ tapestate_set(ti,TS_BLOCK_INIT);
+ tapeblock_exec_IO(ti);
+ s390irq_spin_unlock_irqrestore(ti->devinfo.irq,lockflags);
}
static void
-run_tapeblock_exec_IO (tape_info_t* tape) {
+run_tapeblock_exec_IO (tape_info_t* ti) {
long flags_390irq,flags_ior;
spin_lock_irqsave (&io_request_lock, flags_ior);
- s390irq_spin_lock_irqsave(tape->devinfo.irq,flags_390irq);
- atomic_set(&tape->bh_scheduled,0);
- tapeblock_exec_IO(tape);
- s390irq_spin_unlock_irqrestore(tape->devinfo.irq,flags_390irq);
+ s390irq_spin_lock_irqsave(ti->devinfo.irq,flags_390irq);
+ atomic_set(&ti->bh_scheduled,0);
+ tapeblock_exec_IO(ti);
+ s390irq_spin_unlock_irqrestore(ti->devinfo.irq,flags_390irq);
spin_unlock_irqrestore (&io_request_lock, flags_ior);
}
void
-schedule_tapeblock_exec_IO (tape_info_t *tape)
+schedule_tapeblock_exec_IO (tape_info_t *ti)
{
/* Protect against rescheduling, when already running */
- if (atomic_compare_and_swap(0,1,&tape->bh_scheduled)) {
+ if (atomic_compare_and_swap(0,1,&ti->bh_scheduled)) {
return;
}
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,3,98))
- INIT_LIST_HEAD(&tape->bh_tq.list);
+ INIT_LIST_HEAD(&ti->bh_tq.list);
#endif
- tape->bh_tq.sync = 0;
- tape->bh_tq.routine = (void *) (void *) run_tapeblock_exec_IO;
- tape->bh_tq.data = tape;
+ ti->bh_tq.sync = 0;
+ ti->bh_tq.routine = (void *) (void *) run_tapeblock_exec_IO;
+ ti->bh_tq.data = ti;
- queue_task (&tape->bh_tq, &tq_immediate);
+ queue_task (&ti->bh_tq, &tq_immediate);
mark_bh (IMMEDIATE_BH);
return;
}
@@ -396,10 +401,10 @@
/* wrappers around do_tape_request for different kernel versions */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,98))
static void tape_request_fn (void) {
- tape_info_t* tape=first_tape_info;
- while (tape!=NULL) {
- do_tape_request(&tape->request_queue);
- tape=tape->next;
+ tape_info_t* ti=first_tape_info;
+ while (ti!=NULL) {
+ do_tape_request(&ti->request_queue);
+ ti=ti->next;
}
}
#else
@@ -409,14 +414,14 @@
#endif
static request_queue_t* tapeblock_getqueue (kdev_t kdev) {
- tape_info_t* tape=first_tape_info;
- while ((tape!=NULL) && (MINOR(kdev)!=tape->blk_minor))
- tape=tape->next;
- if (tape!=NULL) return &tape->request_queue;
+ tape_info_t* ti=first_tape_info;
+ while ((ti!=NULL) && (MINOR(kdev)!=ti->blk_minor))
+ ti=ti->next;
+ if (ti!=NULL) return &ti->request_queue;
return NULL;
}
-int tapeblock_mediumdetect(tape_info_t* tape) {
+int tapeblock_mediumdetect(tape_info_t* ti) {
ccw_req_t* cqr;
int losize=1,hisize=1,rc;
long lockflags;
@@ -426,168 +431,168 @@
PRINT_WARN("Detecting media size. This will take _long_, so get yourself a coffee...\n");
while (1) { //is interruped by break
hisize=hisize << 1; // try twice the size tested before
- cqr=tape->discipline->mtseek (tape, hisize);
+ cqr=ti->discipline->mtseek (ti, hisize);
if (cqr == NULL) {
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"b:ccwg fail");
#endif
return -ENOSPC;
}
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->cqr = cqr;
- tape->wanna_wakeup=0;
- rc = do_IO (tape->devinfo.irq, cqr->cpaddr, (unsigned long) cqr, 0x00, cqr->options);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->cqr = cqr;
+ ti->wanna_wakeup=0;
+ rc = do_IO (ti->devinfo.irq, cqr->cpaddr, (unsigned long) cqr, 0x00, cqr->options);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
if (rc) return -EIO;
- wait_event_interruptible (tape->wq,tape->wanna_wakeup);
- tape->cqr = NULL;
+ wait_event_interruptible (ti->wq,ti->wanna_wakeup);
+ ti->cqr = NULL;
tape_free_request (cqr);
- if (tape->kernbuf) {
- kfree (tape->kernbuf);
- tape->kernbuf=NULL;
+ if (ti->kernbuf) {
+ kfree (ti->kernbuf);
+ ti->kernbuf=NULL;
}
if (signal_pending (current)) {
- tapestate_set (tape, TS_IDLE);
+ tapestate_set (ti, TS_IDLE);
return -ERESTARTSYS;
}
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- if (tapestate_get (tape) == TS_FAILED) {
- tapestate_set (tape, TS_IDLE);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ if (tapestate_get (ti) == TS_FAILED) {
+ tapestate_set (ti, TS_IDLE);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
break;
}
- if (tapestate_get (tape) == TS_NOT_OPER) {
- tape->blk_minor=tape->rew_minor=tape->nor_minor=-1;
- tape->devinfo.irq=-1;
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq,lockflags);
+ if (tapestate_get (ti) == TS_NOT_OPER) {
+ ti->blk_minor=ti->rew_minor=ti->nor_minor=-1;
+ ti->devinfo.irq=-1;
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq,lockflags);
return -ENODEV;
}
- if (tapestate_get (tape) != TS_DONE) {
- tapestate_set (tape, TS_IDLE);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ if (tapestate_get (ti) != TS_DONE) {
+ tapestate_set (ti, TS_IDLE);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
return -EIO;
}
- tapestate_set (tape, TS_IDLE);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ tapestate_set (ti, TS_IDLE);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
losize=hisize;
}
- cqr = tape->discipline->mtrew (tape, 1);
+ cqr = ti->discipline->mtrew (ti, 1);
if (cqr == NULL) {
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"b:ccwg fail");
#endif
return -ENOSPC;
}
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->cqr = cqr;
- tape->wanna_wakeup=0;
- rc = do_IO (tape->devinfo.irq, cqr->cpaddr, (unsigned long) cqr, 0x00, cqr->options);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
- wait_event_interruptible (tape->wq,tape->wanna_wakeup);
- tape->cqr = NULL;
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->cqr = cqr;
+ ti->wanna_wakeup=0;
+ rc = do_IO (ti->devinfo.irq, cqr->cpaddr, (unsigned long) cqr, 0x00, cqr->options);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
+ wait_event_interruptible (ti->wq,ti->wanna_wakeup);
+ ti->cqr = NULL;
tape_free_request (cqr);
if (signal_pending (current)) {
- tapestate_set (tape, TS_IDLE);
+ tapestate_set (ti, TS_IDLE);
return -ERESTARTSYS;
}
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- if (tapestate_get (tape) == TS_FAILED) {
- tapestate_set (tape, TS_IDLE);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ if (tapestate_get (ti) == TS_FAILED) {
+ tapestate_set (ti, TS_IDLE);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
return -EIO;
}
- if (tapestate_get (tape) == TS_NOT_OPER) {
- tape->blk_minor=tape->rew_minor=tape->nor_minor=-1;
- tape->devinfo.irq=-1;
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq,lockflags);
+ if (tapestate_get (ti) == TS_NOT_OPER) {
+ ti->blk_minor=ti->rew_minor=ti->nor_minor=-1;
+ ti->devinfo.irq=-1;
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq,lockflags);
return -ENODEV;
}
- if (tapestate_get (tape) != TS_DONE) {
- tapestate_set (tape, TS_IDLE);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ if (tapestate_get (ti) != TS_DONE) {
+ tapestate_set (ti, TS_IDLE);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
return -EIO;
}
- tapestate_set (tape, TS_IDLE);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ tapestate_set (ti, TS_IDLE);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
while (losize!=hisize) {
- cqr=tape->discipline->mtseek (tape, (hisize+losize)/2+1);
+ cqr=ti->discipline->mtseek (ti, (hisize+losize)/2+1);
if (cqr == NULL) {
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"b:ccwg fail");
#endif
return -ENOSPC;
}
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->cqr = cqr;
- tape->wanna_wakeup=0;
- rc = do_IO (tape->devinfo.irq, cqr->cpaddr, (unsigned long) cqr, 0x00, cqr->options);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->cqr = cqr;
+ ti->wanna_wakeup=0;
+ rc = do_IO (ti->devinfo.irq, cqr->cpaddr, (unsigned long) cqr, 0x00, cqr->options);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
if (rc) return -EIO;
- wait_event_interruptible (tape->wq,tape->wanna_wakeup);
- tape->cqr = NULL;
+ wait_event_interruptible (ti->wq,ti->wanna_wakeup);
+ ti->cqr = NULL;
tape_free_request (cqr);
- if (tape->kernbuf) {
- kfree (tape->kernbuf);
- tape->kernbuf=NULL;
+ if (ti->kernbuf) {
+ kfree (ti->kernbuf);
+ ti->kernbuf=NULL;
}
if (signal_pending (current)) {
- tapestate_set (tape, TS_IDLE);
+ tapestate_set (ti, TS_IDLE);
return -ERESTARTSYS;
}
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- if (tapestate_get (tape) == TS_NOT_OPER) {
- tape->blk_minor=tape->rew_minor=tape->nor_minor=-1;
- tape->devinfo.irq=-1;
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq,lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ if (tapestate_get (ti) == TS_NOT_OPER) {
+ ti->blk_minor=ti->rew_minor=ti->nor_minor=-1;
+ ti->devinfo.irq=-1;
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq,lockflags);
return -ENODEV;
}
- if (tapestate_get (tape) == TS_FAILED) {
- tapestate_set (tape, TS_IDLE);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ if (tapestate_get (ti) == TS_FAILED) {
+ tapestate_set (ti, TS_IDLE);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
hisize=(hisize+losize)/2;
- cqr = tape->discipline->mtrew (tape, 1);
+ cqr = ti->discipline->mtrew (ti, 1);
if (cqr == NULL) {
#ifdef TAPE_DEBUG
debug_text_event (tape_debug_area,6,"b:ccwg fail");
#endif
return -ENOSPC;
}
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- tape->cqr = cqr;
- tape->wanna_wakeup=0;
- rc = do_IO (tape->devinfo.irq, cqr->cpaddr, (unsigned long) cqr, 0x00, cqr->options);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
- wait_event_interruptible (tape->wq,tape->wanna_wakeup);
- tape->cqr = NULL;
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ ti->cqr = cqr;
+ ti->wanna_wakeup=0;
+ rc = do_IO (ti->devinfo.irq, cqr->cpaddr, (unsigned long) cqr, 0x00, cqr->options);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
+ wait_event_interruptible (ti->wq,ti->wanna_wakeup);
+ ti->cqr = NULL;
tape_free_request (cqr);
if (signal_pending (current)) {
- tapestate_set (tape, TS_IDLE);
+ tapestate_set (ti, TS_IDLE);
return -ERESTARTSYS;
}
- s390irq_spin_lock_irqsave (tape->devinfo.irq, lockflags);
- if (tapestate_get (tape) == TS_FAILED) {
- tapestate_set (tape, TS_IDLE);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ s390irq_spin_lock_irqsave (ti->devinfo.irq, lockflags);
+ if (tapestate_get (ti) == TS_FAILED) {
+ tapestate_set (ti, TS_IDLE);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
return -EIO;
}
- if (tapestate_get (tape) != TS_DONE) {
- tapestate_set (tape, TS_IDLE);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ if (tapestate_get (ti) != TS_DONE) {
+ tapestate_set (ti, TS_IDLE);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
return -EIO;
}
- tapestate_set (tape, TS_IDLE);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ tapestate_set (ti, TS_IDLE);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
continue;
}
- if (tapestate_get (tape) != TS_DONE) {
- tapestate_set (tape, TS_IDLE);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ if (tapestate_get (ti) != TS_DONE) {
+ tapestate_set (ti, TS_IDLE);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
return -EIO;
}
- tapestate_set (tape, TS_IDLE);
- s390irq_spin_unlock_irqrestore (tape->devinfo.irq, lockflags);
+ tapestate_set (ti, TS_IDLE);
+ s390irq_spin_unlock_irqrestore (ti->devinfo.irq, lockflags);
losize=(hisize+losize)/2+1;
}
- blk_size[tapeblock_major][tape->blk_minor]=(losize)*(blksize_size[tapeblock_major][tape->blk_minor]/1024);
+ blk_size[tapeblock_major][ti->blk_minor]=(losize)*(blksize_size[tapeblock_major][ti->blk_minor]/1024);
return 0;
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)