Lines Matching refs:fs
75 struct floppy_state *fs; member
103 static int swimiop_eject(struct floppy_state *fs);
111 static int grab_drive(struct floppy_state *fs, enum swim_state state,
113 static void release_drive(struct floppy_state *fs);
114 static void set_timeout(struct floppy_state *fs, int nticks,
118 static void start_request(struct floppy_state *fs);
137 struct floppy_state *fs; in swimiop_init() local
166 fs = &floppy_states[floppy_count]; in swimiop_init()
185 fs->state = idle; in swimiop_init()
187 init_timer(&fs->timeout); in swimiop_init()
275 struct floppy_state *fs = &floppy_states[drive_num]; in swimiop_status_update() local
277 fs->write_prot = (ds->write_prot == 0x80); in swimiop_status_update()
279 fs->ejected = 1; in swimiop_status_update()
281 fs->ejected = 0; in swimiop_status_update()
285 fs->secpercyl = 10; in swimiop_status_update()
286 fs->secpertrack = 10; in swimiop_status_update()
287 fs->total_secs = 800; in swimiop_status_update()
290 fs->secpercyl = 20; in swimiop_status_update()
291 fs->secpertrack = 10; in swimiop_status_update()
292 fs->total_secs = 1600; in swimiop_status_update()
295 fs->secpercyl = 36; in swimiop_status_update()
296 fs->secpertrack = 18; in swimiop_status_update()
297 fs->total_secs = 2880; in swimiop_status_update()
300 fs->secpercyl = 0; in swimiop_status_update()
301 fs->secpertrack = 0; in swimiop_status_update()
302 fs->total_secs = 0; in swimiop_status_update()
307 static int swimiop_eject(struct floppy_state *fs) in swimiop_eject() argument
313 err = grab_drive(fs, ejecting, 1); in swimiop_eject()
318 cmd->drive_num = fs->drive_num; in swimiop_eject()
321 release_drive(fs); in swimiop_eject()
333 release_drive(fs); in swimiop_eject()
343 struct floppy_state *fs; in floppy_ioctl() local
353 fs = &floppy_states[devnum]; in floppy_ioctl()
357 if (fs->ref_count != 1) in floppy_ioctl()
359 err = swimiop_eject(fs); in floppy_ioctl()
372 struct floppy_state *fs; in floppy_open() local
381 fs = &floppy_states[devnum]; in floppy_open()
383 if (fs->ref_count == -1 || filp->f_flags & O_EXCL) return -EBUSY; in floppy_open()
388 if (fs->ejected) in floppy_open()
393 if (fs->write_prot) in floppy_open()
400 fs->ref_count = -1; in floppy_open()
402 ++fs->ref_count; in floppy_open()
409 struct floppy_state *fs; in floppy_release() local
415 fs = &floppy_states[devnum]; in floppy_release()
416 if (fs->ref_count > 0) fs->ref_count--; in floppy_release()
422 struct floppy_state *fs; in floppy_check_change() local
428 fs = &floppy_states[devnum]; in floppy_check_change()
429 return fs->ejected; in floppy_check_change()
434 struct floppy_state *fs; in floppy_revalidate() local
440 fs = &floppy_states[devnum]; in floppy_revalidate()
442 grab_drive(fs, revalidating, 0); in floppy_revalidate()
444 release_drive(fs); in floppy_revalidate()
453 static int grab_drive(struct floppy_state *fs, enum swim_state state, in grab_drive() argument
460 if (fs->state != idle) { in grab_drive()
461 ++fs->wanted; in grab_drive()
462 while (fs->state != available) { in grab_drive()
464 --fs->wanted; in grab_drive()
468 interruptible_sleep_on(&fs->wait); in grab_drive()
470 --fs->wanted; in grab_drive()
472 fs->state = state; in grab_drive()
477 static void release_drive(struct floppy_state *fs) in release_drive() argument
483 fs->state = idle; in release_drive()
484 start_request(fs); in release_drive()
488 static void set_timeout(struct floppy_state *fs, int nticks, in set_timeout() argument
494 if (fs->timeout_pending) in set_timeout()
495 del_timer(&fs->timeout); in set_timeout()
496 fs->timeout.expires = jiffies + nticks; in set_timeout()
497 fs->timeout.function = proc; in set_timeout()
498 fs->timeout.data = (unsigned long) fs; in set_timeout()
499 add_timer(&fs->timeout); in set_timeout()
500 fs->timeout_pending = 1; in set_timeout()
515 struct floppy_state *fs = req->fs; in fd_request_complete() local
518 del_timer(&fs->timeout); in fd_request_complete()
519 fs->timeout_pending = 0; in fd_request_complete()
520 fs->state = idle; in fd_request_complete()
532 start_request(fs); in fd_request_complete()
537 struct floppy_state *fs = (struct floppy_state *) data; in fd_request_timeout() local
539 fs->timeout_pending = 0; in fd_request_timeout()
541 fs->state = idle; in fd_request_timeout()
544 static void start_request(struct floppy_state *fs) in start_request() argument
549 if (fs->state == idle && fs->wanted) { in start_request()
550 fs->state = available; in start_request()
551 wake_up(&fs->wait); in start_request()
554 while (!QUEUE_EMPTY && fs->state == idle) { in start_request()
567 if (CURRENT->sector < 0 || CURRENT->sector >= fs->total_secs) { in start_request()
575 if (fs->ejected) { in start_request()
581 req.fs = fs; in start_request()
585 if (fs->write_prot) { in start_request()
594 cmd->drive_num = fs->drive_num; in start_request()
604 set_timeout(fs, HZ*CURRENT->current_nr_sectors, in start_request()
607 fs->state = transferring; in start_request()