Lines Matching +full:col +full:- +full:offset

1 // SPDX-License-Identifier: GPL-2.0
13 * /dev/vcsuN: similar to /dev/vcsaN but using 4-byte unicode values
14 * instead of 1-byte screen glyph values.
22 * aeb@cwi.nl - efter Friedas begravelse - 950211
24 * machek@k332.feld.cvut.cz - modified not to send characters to wrong console
25 * - fixed some fatal off-by-one bugs (0-- no longer == -1 -> looping and looping and looping...)
26 * - making it shorter - scr_readw are macros which expand in PRETTY long code
88 struct vc_data *vc = param->vc; in vcs_notifier()
91 int currcons = poll->cons_num; in vcs_notifier()
108 currcons--; in vcs_notifier()
109 if (currcons != vc->vc_num) in vcs_notifier()
112 poll->event = code; in vcs_notifier()
113 wake_up_interruptible(&poll->waitq); in vcs_notifier()
114 kill_fasync(&poll->fasync, SIGIO, fa_band); in vcs_notifier()
121 unregister_vt_notifier(&poll->notifier); in vcs_poll_data_free()
128 struct vcs_poll_data *poll = file->private_data, *kill = NULL; in vcs_poll_data_get()
136 poll->cons_num = console(file_inode(file)); in vcs_poll_data_get()
137 init_waitqueue_head(&poll->waitq); in vcs_poll_data_get()
138 poll->notifier.notifier_call = vcs_notifier; in vcs_poll_data_get()
146 poll->event = VT_UPDATE; in vcs_poll_data_get()
148 if (register_vt_notifier(&poll->notifier) != 0) { in vcs_poll_data_get()
154 * This code may be called either through ->poll() or ->fasync(). in vcs_poll_data_get()
161 spin_lock(&file->f_lock); in vcs_poll_data_get()
162 if (!file->private_data) { in vcs_poll_data_get()
163 file->private_data = poll; in vcs_poll_data_get()
167 poll = file->private_data; in vcs_poll_data_get()
169 spin_unlock(&file->f_lock); in vcs_poll_data_get()
177 * vcs_vc - return VC for @inode
194 currcons--; in vcs_vc()
202 * vcs_size - return size for a VC in @vc
215 size = vc->vc_rows * vc->vc_cols; in vcs_size()
219 return -EOPNOTSUPP; in vcs_size()
228 static loff_t vcs_lseek(struct file *file, loff_t offset, int orig) in vcs_lseek() argument
238 return -ENXIO; in vcs_lseek()
245 return fixed_size_llseek(file, offset, orig, size); in vcs_lseek()
251 unsigned int nr, row, col, maxcol = vc->vc_cols; in vcs_read_buf_uni() local
260 col = pos % maxcol; in vcs_read_buf_uni()
261 nr = maxcol - col; in vcs_read_buf_uni()
265 vc_uniscr_copy_line(vc, con_buf, viewed, row, col, nr); in vcs_read_buf_uni()
267 count -= nr * 4; in vcs_read_buf_uni()
269 col = 0; in vcs_read_buf_uni()
280 unsigned int col, maxcol = vc->vc_cols; in vcs_read_buf_noattr() local
283 col = pos % maxcol; in vcs_read_buf_noattr()
284 pos += maxcol - col; in vcs_read_buf_noattr()
286 while (count-- > 0) { in vcs_read_buf_noattr()
288 if (++col == maxcol) { in vcs_read_buf_noattr()
290 col = 0; in vcs_read_buf_noattr()
301 unsigned int col, maxcol = vc->vc_cols; in vcs_read_buf() local
306 con_buf[0] = min(vc->vc_rows, 0xFFu); in vcs_read_buf()
307 con_buf[1] = min(vc->vc_cols, 0xFFu); in vcs_read_buf()
314 filled = count - pos; in vcs_read_buf()
318 count -= min(HEADER_SIZE, count); in vcs_read_buf()
331 filled--; in vcs_read_buf()
337 pos -= HEADER_SIZE; in vcs_read_buf()
339 col = pos % maxcol; in vcs_read_buf()
342 pos += maxcol - col; in vcs_read_buf()
353 count--; in vcs_read_buf()
354 if (++col == maxcol) { in vcs_read_buf()
356 col = 0; in vcs_read_buf()
378 return -ENOMEM; in vcs_read()
390 ret = -EINVAL; in vcs_read()
393 /* we enforce 32-bit alignment for pos and count in unicode mode */ in vcs_read()
397 poll = file->private_data; in vcs_read()
399 poll->event = 0; in vcs_read()
408 ret = -ENXIO; in vcs_read()
423 if (count > size - pos) in vcs_read()
424 count = size - pos; in vcs_read()
460 read += this_round - ret; in vcs_read()
461 ret = -EFAULT; in vcs_read()
467 count -= this_round; in vcs_read()
482 unsigned int col, maxcol = vc->vc_cols; in vcs_write_buf_noattr() local
485 col = pos % maxcol; in vcs_write_buf_noattr()
486 pos += maxcol - col; in vcs_write_buf_noattr()
491 count--; in vcs_write_buf_noattr()
495 if (++col == maxcol) { in vcs_write_buf_noattr()
497 col = 0; in vcs_write_buf_noattr()
522 unsigned int col, maxcol = vc->vc_cols; in vcs_write_buf() local
531 count--; in vcs_write_buf()
541 pos -= HEADER_SIZE; in vcs_write_buf()
542 col = (pos/2) % maxcol; in vcs_write_buf()
546 /* odd pos -- the first single character */ in vcs_write_buf()
548 count--; in vcs_write_buf()
554 if (++col == maxcol) { in vcs_write_buf()
556 col = 0; in vcs_write_buf()
561 pos += maxcol - col; in vcs_write_buf()
563 /* even pos -- handle attr+character pairs */ in vcs_write_buf()
570 count -= 2; in vcs_write_buf()
571 if (++col == maxcol) { in vcs_write_buf()
573 col = 0; in vcs_write_buf()
581 /* odd pos -- the remaining character */ in vcs_write_buf()
603 return -EOPNOTSUPP; in vcs_write()
607 return -ENOMEM; in vcs_write()
617 ret = -ENXIO; in vcs_write()
627 ret = -EINVAL; in vcs_write()
630 if (count > size - pos) in vcs_write()
631 count = size - pos; in vcs_write()
647 this_round -= ret; in vcs_write()
650 * fail with -EFAULT. in vcs_write()
654 ret = -EFAULT; in vcs_write()
667 ret = -ENXIO; in vcs_write()
679 if (this_round > size - pos) in vcs_write()
680 this_round = size - pos; in vcs_write()
693 count -= this_round; in vcs_write()
698 update_region(vc, (unsigned long)(org0), org - org0); in vcs_write()
718 poll_wait(file, &poll->waitq, wait); in vcs_poll()
719 switch (poll->event) { in vcs_poll()
737 struct vcs_poll_data *poll = file->private_data; in vcs_fasync()
745 return -ENOMEM; in vcs_fasync()
748 return fasync_helper(fd, file, on, &poll->fasync); in vcs_fasync()
761 return -EOPNOTSUPP; in vcs_open()
764 if(currcons && !vc_cons_allocated(currcons-1)) in vcs_open()
765 ret = -ENXIO; in vcs_open()
772 struct vcs_poll_data *poll = file->private_data; in vcs_release()