Lines Matching refs:fp

53 static inline int fs3270_working(struct fs3270 *fp)  in fs3270_working()  argument
59 return fp->active && raw3270_request_final(fp->init); in fs3270_working()
64 struct fs3270 *fp; in fs3270_do_io() local
67 fp = (struct fs3270 *)view; in fs3270_do_io()
69 rq->callback_data = &fp->wait; in fs3270_do_io()
72 if (!fs3270_working(fp)) { in fs3270_do_io()
74 rc = wait_event_interruptible(fp->wait, in fs3270_do_io()
75 fs3270_working(fp)); in fs3270_do_io()
82 wait_event(fp->wait, raw3270_request_final(rq)); in fs3270_do_io()
93 struct fs3270 *fp; in fs3270_reset_callback() local
95 fp = (struct fs3270 *)rq->view; in fs3270_reset_callback()
97 wake_up(&fp->wait); in fs3270_reset_callback()
102 struct fs3270 *fp; in fs3270_restore_callback() local
104 fp = (struct fs3270 *)rq->view; in fs3270_restore_callback()
106 if (fp->fs_pid) in fs3270_restore_callback()
107 kill_pid(fp->fs_pid, SIGHUP, 1); in fs3270_restore_callback()
109 fp->rdbuf_size = 0; in fs3270_restore_callback()
111 wake_up(&fp->wait); in fs3270_restore_callback()
116 struct fs3270 *fp; in fs3270_activate() local
120 fp = (struct fs3270 *)view; in fs3270_activate()
123 if (!raw3270_request_final(fp->init)) in fs3270_activate()
126 raw3270_request_set_cmd(fp->init, TC_EWRITEA); in fs3270_activate()
127 raw3270_request_set_idal(fp->init, fp->rdbuf); in fs3270_activate()
128 fp->init->rescnt = 0; in fs3270_activate()
129 cp = fp->rdbuf->data[0]; in fs3270_activate()
130 if (fp->rdbuf_size == 0) { in fs3270_activate()
132 fp->init->ccw.count = 1; in fs3270_activate()
133 fp->init->callback = fs3270_reset_callback; in fs3270_activate()
137 fp->init->ccw.count = fp->rdbuf_size; in fs3270_activate()
138 fp->init->callback = fs3270_restore_callback; in fs3270_activate()
148 rc = raw3270_start_locked(view, fp->init); in fs3270_activate()
149 fp->init->rc = rc; in fs3270_activate()
151 fp->init->callback(fp->init, NULL); in fs3270_activate()
153 fp->active = 1; in fs3270_activate()
162 struct fs3270 *fp; in fs3270_save_callback() local
164 fp = (struct fs3270 *)rq->view; in fs3270_save_callback()
167 fp->rdbuf->data[0] -= 5; in fs3270_save_callback()
168 fp->rdbuf->size += 5; in fs3270_save_callback()
177 if (fp->fs_pid) in fs3270_save_callback()
178 kill_pid(fp->fs_pid, SIGHUP, 1); in fs3270_save_callback()
179 fp->rdbuf_size = 0; in fs3270_save_callback()
181 fp->rdbuf_size = fp->rdbuf->size - rq->rescnt; in fs3270_save_callback()
184 wake_up(&fp->wait); in fs3270_save_callback()
189 struct fs3270 *fp; in fs3270_deactivate() local
191 fp = (struct fs3270 *)view; in fs3270_deactivate()
192 fp->active = 0; in fs3270_deactivate()
195 if (!raw3270_request_final(fp->init)) in fs3270_deactivate()
199 raw3270_request_set_cmd(fp->init, TC_RDBUF); in fs3270_deactivate()
205 fp->rdbuf->data[0] += 5; in fs3270_deactivate()
206 fp->rdbuf->size -= 5; in fs3270_deactivate()
207 raw3270_request_set_idal(fp->init, fp->rdbuf); in fs3270_deactivate()
208 fp->init->rescnt = 0; in fs3270_deactivate()
209 fp->init->callback = fs3270_save_callback; in fs3270_deactivate()
212 fp->init->rc = raw3270_start_locked(view, fp->init); in fs3270_deactivate()
213 if (fp->init->rc) in fs3270_deactivate()
214 fp->init->callback(fp->init, NULL); in fs3270_deactivate()
217 static void fs3270_irq(struct fs3270 *fp, struct raw3270_request *rq, in fs3270_irq() argument
222 fp->attention = 1; in fs3270_irq()
223 wake_up(&fp->wait); in fs3270_irq()
241 struct fs3270 *fp; in fs3270_read() local
248 fp = filp->private_data; in fs3270_read()
249 if (!fp) in fs3270_read()
256 if (fp->read_command == 0 && fp->write_command != 0) in fs3270_read()
257 fp->read_command = 6; in fs3270_read()
258 raw3270_request_set_cmd(rq, fp->read_command ? : 2); in fs3270_read()
260 rc = wait_event_interruptible(fp->wait, fp->attention); in fs3270_read()
261 fp->attention = 0; in fs3270_read()
263 rc = fs3270_do_io(&fp->view, rq); in fs3270_read()
286 struct fs3270 *fp; in fs3270_write() local
292 fp = filp->private_data; in fs3270_write()
293 if (!fp) in fs3270_write()
301 write_command = fp->write_command ? : 1; in fs3270_write()
306 rc = fs3270_do_io(&fp->view, rq); in fs3270_write()
326 struct fs3270 *fp; in fs3270_ioctl() local
330 fp = filp->private_data; in fs3270_ioctl()
331 if (!fp) in fs3270_ioctl()
341 fp->read_command = arg; in fs3270_ioctl()
344 fp->write_command = arg; in fs3270_ioctl()
347 rc = put_user(fp->read_command, argp); in fs3270_ioctl()
350 rc = put_user(fp->write_command, argp); in fs3270_ioctl()
353 iocb.model = fp->view.model; in fs3270_ioctl()
354 iocb.line_cnt = fp->view.rows; in fs3270_ioctl()
355 iocb.col_cnt = fp->view.cols; in fs3270_ioctl()
372 struct fs3270 *fp; in fs3270_alloc_view() local
374 fp = kzalloc(sizeof(*fp), GFP_KERNEL); in fs3270_alloc_view()
375 if (!fp) in fs3270_alloc_view()
377 fp->init = raw3270_request_alloc(0); in fs3270_alloc_view()
378 if (IS_ERR(fp->init)) { in fs3270_alloc_view()
379 kfree(fp); in fs3270_alloc_view()
382 return fp; in fs3270_alloc_view()
390 struct fs3270 *fp; in fs3270_free_view() local
392 fp = (struct fs3270 *)view; in fs3270_free_view()
393 if (fp->rdbuf) in fs3270_free_view()
394 idal_buffer_free(fp->rdbuf); in fs3270_free_view()
404 struct fs3270 *fp; in fs3270_release() local
406 fp = (struct fs3270 *)view; in fs3270_release()
407 if (fp->fs_pid) in fs3270_release()
408 kill_pid(fp->fs_pid, SIGHUP, 1); in fs3270_release()
425 struct fs3270 *fp; in fs3270_open() local
445 fp = (struct fs3270 *)raw3270_find_view(&fs3270_fn, minor); in fs3270_open()
446 if (!IS_ERR(fp)) { in fs3270_open()
447 raw3270_put_view(&fp->view); in fs3270_open()
452 fp = fs3270_alloc_view(); in fs3270_open()
453 if (IS_ERR(fp)) { in fs3270_open()
454 rc = PTR_ERR(fp); in fs3270_open()
458 init_waitqueue_head(&fp->wait); in fs3270_open()
459 fp->fs_pid = get_pid(task_pid(current)); in fs3270_open()
460 rc = raw3270_add_view(&fp->view, &fs3270_fn, minor, in fs3270_open()
463 fs3270_free_view(&fp->view); in fs3270_open()
468 ib = idal_buffer_alloc(2 * fp->view.rows * fp->view.cols + 5, 0); in fs3270_open()
470 raw3270_put_view(&fp->view); in fs3270_open()
471 raw3270_del_view(&fp->view); in fs3270_open()
475 fp->rdbuf = ib; in fs3270_open()
477 rc = raw3270_activate_view(&fp->view); in fs3270_open()
479 raw3270_put_view(&fp->view); in fs3270_open()
480 raw3270_del_view(&fp->view); in fs3270_open()
484 filp->private_data = fp; in fs3270_open()
496 struct fs3270 *fp; in fs3270_close() local
498 fp = filp->private_data; in fs3270_close()
500 if (fp) { in fs3270_close()
501 put_pid(fp->fs_pid); in fs3270_close()
502 fp->fs_pid = NULL; in fs3270_close()
503 raw3270_reset(&fp->view); in fs3270_close()
504 raw3270_put_view(&fp->view); in fs3270_close()
505 raw3270_del_view(&fp->view); in fs3270_close()