Lines Matching refs:device

64 tapechar_setup_device(struct tape_device * device)  in tapechar_setup_device()  argument
68 sprintf(device_name, "ntibm%i", device->first_minor / 2); in tapechar_setup_device()
69 device->nt = register_tape_dev( in tapechar_setup_device()
70 &device->cdev->dev, in tapechar_setup_device()
71 MKDEV(tapechar_major, device->first_minor), in tapechar_setup_device()
77 device->rt = register_tape_dev( in tapechar_setup_device()
78 &device->cdev->dev, in tapechar_setup_device()
79 MKDEV(tapechar_major, device->first_minor + 1), in tapechar_setup_device()
89 tapechar_cleanup_device(struct tape_device *device) in tapechar_cleanup_device() argument
91 unregister_tape_dev(&device->cdev->dev, device->rt); in tapechar_cleanup_device()
92 device->rt = NULL; in tapechar_cleanup_device()
93 unregister_tape_dev(&device->cdev->dev, device->nt); in tapechar_cleanup_device()
94 device->nt = NULL; in tapechar_cleanup_device()
98 tapechar_check_idalbuffer(struct tape_device *device, size_t block_size) in tapechar_check_idalbuffer() argument
102 if (device->char_data.idal_buf != NULL && in tapechar_check_idalbuffer()
103 device->char_data.idal_buf->size == block_size) in tapechar_check_idalbuffer()
117 if (device->char_data.idal_buf != NULL) in tapechar_check_idalbuffer()
118 idal_buffer_free(device->char_data.idal_buf); in tapechar_check_idalbuffer()
120 device->char_data.idal_buf = new; in tapechar_check_idalbuffer()
131 struct tape_device *device; in tapechar_read() local
137 device = (struct tape_device *) filp->private_data; in tapechar_read()
144 if(device->required_tapemarks) { in tapechar_read()
145 return tape_std_terminate_write(device); in tapechar_read()
149 if (device->char_data.block_size != 0) { in tapechar_read()
150 if (count < device->char_data.block_size) { in tapechar_read()
155 block_size = device->char_data.block_size; in tapechar_read()
160 rc = tapechar_check_idalbuffer(device, block_size); in tapechar_read()
166 request = device->discipline->read_block(device, block_size); in tapechar_read()
170 rc = tape_do_io(device, request); in tapechar_read()
175 if (idal_buffer_to_user(device->char_data.idal_buf, in tapechar_read()
189 struct tape_device *device; in tapechar_write() local
197 device = (struct tape_device *) filp->private_data; in tapechar_write()
199 if (device->char_data.block_size != 0) { in tapechar_write()
200 if (count < device->char_data.block_size) { in tapechar_write()
205 block_size = device->char_data.block_size; in tapechar_write()
212 rc = tapechar_check_idalbuffer(device, block_size); in tapechar_write()
219 request = device->discipline->write_block(device, block_size); in tapechar_write()
226 if (idal_buffer_from_user(device->char_data.idal_buf, in tapechar_write()
231 rc = tape_do_io(device, request); in tapechar_write()
247 if (device->discipline->process_eov) in tapechar_write()
248 device->discipline->process_eov(device); in tapechar_write()
262 device->required_tapemarks = 2; in tapechar_write()
273 struct tape_device *device; in tapechar_open() local
284 device = tape_find_device(minor / TAPE_MINORS_PER_DEV); in tapechar_open()
285 if (IS_ERR(device)) { in tapechar_open()
287 return PTR_ERR(device); in tapechar_open()
290 rc = tape_open(device); in tapechar_open()
292 filp->private_data = device; in tapechar_open()
295 tape_put_device(device); in tapechar_open()
307 struct tape_device *device; in tapechar_release() local
310 device = (struct tape_device *) filp->private_data; in tapechar_release()
318 if (device->required_tapemarks) in tapechar_release()
319 tape_std_terminate_write(device); in tapechar_release()
320 tape_mtop(device, MTREW, 1); in tapechar_release()
322 if (device->required_tapemarks > 1) { in tapechar_release()
323 if (tape_mtop(device, MTWEOF, 1) == 0) in tapechar_release()
324 device->required_tapemarks--; in tapechar_release()
328 if (device->char_data.idal_buf != NULL) { in tapechar_release()
329 idal_buffer_free(device->char_data.idal_buf); in tapechar_release()
330 device->char_data.idal_buf = NULL; in tapechar_release()
332 tape_release(device); in tapechar_release()
334 tape_put_device(device); in tapechar_release()
343 __tapechar_ioctl(struct tape_device *device, in __tapechar_ioctl() argument
372 if (device->required_tapemarks) in __tapechar_ioctl()
373 tape_std_terminate_write(device); in __tapechar_ioctl()
375 rc = tape_mtop(device, op.mt_op, op.mt_count); in __tapechar_ioctl()
378 if (op.mt_count > device->required_tapemarks) in __tapechar_ioctl()
379 device->required_tapemarks = 0; in __tapechar_ioctl()
381 device->required_tapemarks -= op.mt_count; in __tapechar_ioctl()
389 rc = tape_mtop(device, MTTELL, 1); in __tapechar_ioctl()
403 ((device->char_data.block_size << MT_ST_BLKSIZE_SHIFT) in __tapechar_ioctl()
409 get.mt_gstat = device->tape_generic_status; in __tapechar_ioctl()
411 if (device->medium_state == MS_LOADED) { in __tapechar_ioctl()
412 rc = tape_mtop(device, MTTELL, 1); in __tapechar_ioctl()
426 if (device->discipline->ioctl_fn == NULL) in __tapechar_ioctl()
428 return device->discipline->ioctl_fn(device, no, (unsigned long)data); in __tapechar_ioctl()
434 struct tape_device *device; in tapechar_ioctl() local
439 device = (struct tape_device *) filp->private_data; in tapechar_ioctl()
440 mutex_lock(&device->mutex); in tapechar_ioctl()
441 rc = __tapechar_ioctl(device, no, (void __user *)data); in tapechar_ioctl()
442 mutex_unlock(&device->mutex); in tapechar_ioctl()
450 struct tape_device *device = filp->private_data; in tapechar_compat_ioctl() local
458 mutex_lock(&device->mutex); in tapechar_compat_ioctl()
459 rc = __tapechar_ioctl(device, no, compat_ptr(data)); in tapechar_compat_ioctl()
460 mutex_unlock(&device->mutex); in tapechar_compat_ioctl()