vc_screen: extract vcs_read_buf_uni
[linux-2.6-microblaze.git] / drivers / tty / vt / vc_screen.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Provide access to virtual console memory.
4  * /dev/vcs: the screen as it is being viewed right now (possibly scrolled)
5  * /dev/vcsN: the screen of /dev/ttyN (1 <= N <= 63)
6  *            [minor: N]
7  *
8  * /dev/vcsaN: idem, but including attributes, and prefixed with
9  *      the 4 bytes lines,columns,x,y (as screendump used to give).
10  *      Attribute/character pair is in native endianity.
11  *            [minor: N+128]
12  *
13  * /dev/vcsuN: similar to /dev/vcsaN but using 4-byte unicode values
14  *      instead of 1-byte screen glyph values.
15  *            [minor: N+64]
16  *
17  * /dev/vcsuaN: same idea as /dev/vcsaN for unicode (not yet implemented).
18  *
19  * This replaces screendump and part of selection, so that the system
20  * administrator can control access using file system permissions.
21  *
22  * aeb@cwi.nl - efter Friedas begravelse - 950211
23  *
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
27  */
28
29 #include <linux/kernel.h>
30 #include <linux/major.h>
31 #include <linux/errno.h>
32 #include <linux/export.h>
33 #include <linux/tty.h>
34 #include <linux/interrupt.h>
35 #include <linux/mm.h>
36 #include <linux/init.h>
37 #include <linux/vt_kern.h>
38 #include <linux/selection.h>
39 #include <linux/kbd_kern.h>
40 #include <linux/console.h>
41 #include <linux/device.h>
42 #include <linux/sched.h>
43 #include <linux/fs.h>
44 #include <linux/poll.h>
45 #include <linux/signal.h>
46 #include <linux/slab.h>
47 #include <linux/notifier.h>
48
49 #include <linux/uaccess.h>
50 #include <asm/byteorder.h>
51 #include <asm/unaligned.h>
52
53 #undef attr
54 #undef org
55 #undef addr
56 #define HEADER_SIZE     4u
57
58 #define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE)
59
60 /*
61  * Our minor space:
62  *
63  *   0 ... 63   glyph mode without attributes
64  *  64 ... 127  unicode mode without attributes
65  * 128 ... 191  glyph mode with attributes
66  * 192 ... 255  unused (reserved for unicode with attributes)
67  *
68  * This relies on MAX_NR_CONSOLES being  <= 63, meaning 63 actual consoles
69  * with minors 0, 64, 128 and 192 being proxies for the foreground console.
70  */
71 #if MAX_NR_CONSOLES > 63
72 #warning "/dev/vcs* devices may not accommodate more than 63 consoles"
73 #endif
74
75 #define console(inode)          (iminor(inode) & 63)
76 #define use_unicode(inode)      (iminor(inode) & 64)
77 #define use_attributes(inode)   (iminor(inode) & 128)
78
79
80 struct vcs_poll_data {
81         struct notifier_block notifier;
82         unsigned int cons_num;
83         int event;
84         wait_queue_head_t waitq;
85         struct fasync_struct *fasync;
86 };
87
88 static int
89 vcs_notifier(struct notifier_block *nb, unsigned long code, void *_param)
90 {
91         struct vt_notifier_param *param = _param;
92         struct vc_data *vc = param->vc;
93         struct vcs_poll_data *poll =
94                 container_of(nb, struct vcs_poll_data, notifier);
95         int currcons = poll->cons_num;
96         int fa_band;
97
98         switch (code) {
99         case VT_UPDATE:
100                 fa_band = POLL_PRI;
101                 break;
102         case VT_DEALLOCATE:
103                 fa_band = POLL_HUP;
104                 break;
105         default:
106                 return NOTIFY_DONE;
107         }
108
109         if (currcons == 0)
110                 currcons = fg_console;
111         else
112                 currcons--;
113         if (currcons != vc->vc_num)
114                 return NOTIFY_DONE;
115
116         poll->event = code;
117         wake_up_interruptible(&poll->waitq);
118         kill_fasync(&poll->fasync, SIGIO, fa_band);
119         return NOTIFY_OK;
120 }
121
122 static void
123 vcs_poll_data_free(struct vcs_poll_data *poll)
124 {
125         unregister_vt_notifier(&poll->notifier);
126         kfree(poll);
127 }
128
129 static struct vcs_poll_data *
130 vcs_poll_data_get(struct file *file)
131 {
132         struct vcs_poll_data *poll = file->private_data, *kill = NULL;
133
134         if (poll)
135                 return poll;
136
137         poll = kzalloc(sizeof(*poll), GFP_KERNEL);
138         if (!poll)
139                 return NULL;
140         poll->cons_num = console(file_inode(file));
141         init_waitqueue_head(&poll->waitq);
142         poll->notifier.notifier_call = vcs_notifier;
143         /*
144          * In order not to lose any update event, we must pretend one might
145          * have occurred before we have a chance to register our notifier.
146          * This is also how user space has come to detect which kernels
147          * support POLLPRI on /dev/vcs* devices i.e. using poll() with
148          * POLLPRI and a zero timeout.
149          */
150         poll->event = VT_UPDATE;
151
152         if (register_vt_notifier(&poll->notifier) != 0) {
153                 kfree(poll);
154                 return NULL;
155         }
156
157         /*
158          * This code may be called either through ->poll() or ->fasync().
159          * If we have two threads using the same file descriptor, they could
160          * both enter this function, both notice that the structure hasn't
161          * been allocated yet and go ahead allocating it in parallel, but
162          * only one of them must survive and be shared otherwise we'd leak
163          * memory with a dangling notifier callback.
164          */
165         spin_lock(&file->f_lock);
166         if (!file->private_data) {
167                 file->private_data = poll;
168         } else {
169                 /* someone else raced ahead of us */
170                 kill = poll;
171                 poll = file->private_data;
172         }
173         spin_unlock(&file->f_lock);
174         if (kill)
175                 vcs_poll_data_free(kill);
176
177         return poll;
178 }
179
180 /**
181  * vcs_vc -- return VC for @inode
182  * @inode: inode for which to return a VC
183  * @viewed: returns whether this console is currently foreground (viewed)
184  *
185  * Must be called with console_lock.
186  */
187 static struct vc_data *vcs_vc(struct inode *inode, bool *viewed)
188 {
189         unsigned int currcons = console(inode);
190
191         WARN_CONSOLE_UNLOCKED();
192
193         if (currcons == 0) {
194                 currcons = fg_console;
195                 if (viewed)
196                         *viewed = true;
197         } else {
198                 currcons--;
199                 if (viewed)
200                         *viewed = false;
201         }
202         return vc_cons[currcons].d;
203 }
204
205 /**
206  * vcs_size -- return size for a VC in @vc
207  * @vc: which VC
208  * @attr: does it use attributes?
209  * @unicode: is it unicode?
210  *
211  * Must be called with console_lock.
212  */
213 static int vcs_size(const struct vc_data *vc, bool attr, bool unicode)
214 {
215         int size;
216
217         WARN_CONSOLE_UNLOCKED();
218
219         size = vc->vc_rows * vc->vc_cols;
220
221         if (attr) {
222                 if (unicode)
223                         return -EOPNOTSUPP;
224
225                 size = 2 * size + HEADER_SIZE;
226         } else if (unicode)
227                 size *= 4;
228
229         return size;
230 }
231
232 static loff_t vcs_lseek(struct file *file, loff_t offset, int orig)
233 {
234         struct inode *inode = file_inode(file);
235         struct vc_data *vc;
236         int size;
237
238         console_lock();
239         vc = vcs_vc(inode, NULL);
240         if (!vc) {
241                 console_unlock();
242                 return -ENXIO;
243         }
244
245         size = vcs_size(vc, use_attributes(inode), use_unicode(inode));
246         console_unlock();
247         if (size < 0)
248                 return size;
249         return fixed_size_llseek(file, offset, orig, size);
250 }
251
252 static int vcs_read_buf_uni(struct vc_data *vc, char *con_buf,
253                 unsigned int pos, unsigned int count, bool viewed)
254 {
255         unsigned int nr, row, col, maxcol = vc->vc_cols;
256         int ret;
257
258         ret = vc_uniscr_check(vc);
259         if (ret)
260                 return ret;
261
262         pos /= 4;
263         row = pos / maxcol;
264         col = pos % maxcol;
265         nr = maxcol - col;
266         do {
267                 if (nr > count / 4)
268                         nr = count / 4;
269                 vc_uniscr_copy_line(vc, con_buf, viewed, row, col, nr);
270                 con_buf += nr * 4;
271                 count -= nr * 4;
272                 row++;
273                 col = 0;
274                 nr = maxcol;
275         } while (count);
276
277         return 0;
278 }
279
280 static ssize_t
281 vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
282 {
283         struct inode *inode = file_inode(file);
284         struct vc_data *vc;
285         struct vcs_poll_data *poll;
286         u16 *org;
287         unsigned int read, col, maxcol;
288         ssize_t ret;
289         char *con_buf;
290         loff_t pos;
291         bool viewed, attr, uni_mode;
292
293         con_buf = (char *) __get_free_page(GFP_KERNEL);
294         if (!con_buf)
295                 return -ENOMEM;
296
297         pos = *ppos;
298
299         /* Select the proper current console and verify
300          * sanity of the situation under the console lock.
301          */
302         console_lock();
303
304         uni_mode = use_unicode(inode);
305         attr = use_attributes(inode);
306         ret = -ENXIO;
307         vc = vcs_vc(inode, &viewed);
308         if (!vc)
309                 goto unlock_out;
310
311         ret = -EINVAL;
312         if (pos < 0)
313                 goto unlock_out;
314         /* we enforce 32-bit alignment for pos and count in unicode mode */
315         if (uni_mode && (pos | count) & 3)
316                 goto unlock_out;
317
318         poll = file->private_data;
319         if (count && poll)
320                 poll->event = 0;
321         read = 0;
322         ret = 0;
323         while (count) {
324                 char *con_buf0, *con_buf_start;
325                 unsigned int this_round, orig_count, p = pos;
326                 int size;
327
328                 /* Check whether we are above size each round,
329                  * as copy_to_user at the end of this loop
330                  * could sleep.
331                  */
332                 size = vcs_size(vc, attr, uni_mode);
333                 if (size < 0) {
334                         if (read)
335                                 break;
336                         ret = size;
337                         goto unlock_out;
338                 }
339                 if (pos >= size)
340                         break;
341                 if (count > size - pos)
342                         count = size - pos;
343
344                 this_round = count;
345                 if (this_round > CON_BUF_SIZE)
346                         this_round = CON_BUF_SIZE;
347
348                 /* Perform the whole read into the local con_buf.
349                  * Then we can drop the console spinlock and safely
350                  * attempt to move it to userspace.
351                  */
352
353                 con_buf_start = con_buf0 = con_buf;
354                 orig_count = this_round;
355                 maxcol = vc->vc_cols;
356                 if (uni_mode) {
357                         ret = vcs_read_buf_uni(vc, con_buf, pos, this_round,
358                                         viewed);
359                         if (ret)
360                                 break;
361                 } else if (!attr) {
362                         org = screen_pos(vc, p, viewed);
363                         col = p % maxcol;
364                         p += maxcol - col;
365                         while (this_round-- > 0) {
366                                 *con_buf0++ = (vcs_scr_readw(vc, org++) & 0xff);
367                                 if (++col == maxcol) {
368                                         org = screen_pos(vc, p, viewed);
369                                         col = 0;
370                                         p += maxcol;
371                                 }
372                         }
373                 } else {
374                         if (p < HEADER_SIZE) {
375                                 /* clamp header values if they don't fit */
376                                 con_buf0[0] = min(vc->vc_rows, 0xFFu);
377                                 con_buf0[1] = min(vc->vc_cols, 0xFFu);
378                                 getconsxy(vc, con_buf0 + 2);
379
380                                 con_buf_start += p;
381                                 this_round += p;
382                                 if (this_round > CON_BUF_SIZE) {
383                                         this_round = CON_BUF_SIZE;
384                                         orig_count = this_round - p;
385                                 }
386
387                                 /* Advance state pointers and move on. */
388                                 this_round -= min(HEADER_SIZE, this_round);
389                                 p = HEADER_SIZE;
390                                 con_buf0 = con_buf + HEADER_SIZE;
391                                 /* If this_round >= 0, then p is even... */
392                         } else if (p & 1) {
393                                 /* Skip first byte for output if start address is odd
394                                  * Update region sizes up/down depending on free
395                                  * space in buffer.
396                                  */
397                                 con_buf_start++;
398                                 if (this_round < CON_BUF_SIZE)
399                                         this_round++;
400                                 else
401                                         orig_count--;
402                         }
403                         if (this_round > 0) {
404                                 unsigned short *tmp_buf = (unsigned short *)con_buf0;
405
406                                 p -= HEADER_SIZE;
407                                 p /= 2;
408                                 col = p % maxcol;
409
410                                 org = screen_pos(vc, p, viewed);
411                                 p += maxcol - col;
412
413                                 /* Buffer has even length, so we can always copy
414                                  * character + attribute. We do not copy last byte
415                                  * to userspace if this_round is odd.
416                                  */
417                                 this_round = (this_round + 1) >> 1;
418
419                                 while (this_round) {
420                                         *tmp_buf++ = vcs_scr_readw(vc, org++);
421                                         this_round --;
422                                         if (++col == maxcol) {
423                                                 org = screen_pos(vc, p, viewed);
424                                                 col = 0;
425                                                 p += maxcol;
426                                         }
427                                 }
428                         }
429                 }
430
431                 /* Finally, release the console semaphore while we push
432                  * all the data to userspace from our temporary buffer.
433                  *
434                  * AKPM: Even though it's a semaphore, we should drop it because
435                  * the pagefault handling code may want to call printk().
436                  */
437
438                 console_unlock();
439                 ret = copy_to_user(buf, con_buf_start, orig_count);
440                 console_lock();
441
442                 if (ret) {
443                         read += (orig_count - ret);
444                         ret = -EFAULT;
445                         break;
446                 }
447                 buf += orig_count;
448                 pos += orig_count;
449                 read += orig_count;
450                 count -= orig_count;
451         }
452         *ppos += read;
453         if (read)
454                 ret = read;
455 unlock_out:
456         console_unlock();
457         free_page((unsigned long) con_buf);
458         return ret;
459 }
460
461 static u16 *vcs_write_buf_noattr(struct vc_data *vc, const char *con_buf,
462                 unsigned int pos, unsigned int count, bool viewed, u16 **org0)
463 {
464         u16 *org;
465         unsigned int col, maxcol = vc->vc_cols;
466
467         *org0 = org = screen_pos(vc, pos, viewed);
468         col = pos % maxcol;
469         pos += maxcol - col;
470
471         while (count > 0) {
472                 unsigned char c = *con_buf++;
473
474                 count--;
475                 vcs_scr_writew(vc,
476                                (vcs_scr_readw(vc, org) & 0xff00) | c, org);
477                 org++;
478                 if (++col == maxcol) {
479                         org = screen_pos(vc, pos, viewed);
480                         col = 0;
481                         pos += maxcol;
482                 }
483         }
484
485         return org;
486 }
487
488 /*
489  * Compilers (gcc 10) are unable to optimize the swap in cpu_to_le16. So do it
490  * the poor man way.
491  */
492 static inline u16 vc_compile_le16(u8 hi, u8 lo)
493 {
494 #ifdef __BIG_ENDIAN
495         return (lo << 8u) | hi;
496 #else
497         return (hi << 8u) | lo;
498 #endif
499 }
500
501 static u16 *vcs_write_buf(struct vc_data *vc, const char *con_buf,
502                 unsigned int pos, unsigned int count, bool viewed, u16 **org0)
503 {
504         u16 *org;
505         unsigned int col, maxcol = vc->vc_cols;
506         unsigned char c;
507
508         /* header */
509         if (pos < HEADER_SIZE) {
510                 char header[HEADER_SIZE];
511
512                 getconsxy(vc, header + 2);
513                 while (pos < HEADER_SIZE && count > 0) {
514                         count--;
515                         header[pos++] = *con_buf++;
516                 }
517                 if (!viewed)
518                         putconsxy(vc, header + 2);
519         }
520
521         if (!count)
522                 return NULL;
523
524         pos -= HEADER_SIZE;
525         col = (pos/2) % maxcol;
526
527         *org0 = org = screen_pos(vc, pos/2, viewed);
528
529         /* odd pos -- the first single character */
530         if (pos & 1) {
531                 count--;
532                 c = *con_buf++;
533                 vcs_scr_writew(vc, vc_compile_le16(c, vcs_scr_readw(vc, org)),
534                                 org);
535                 org++;
536                 pos++;
537                 if (++col == maxcol) {
538                         org = screen_pos(vc, pos/2, viewed);
539                         col = 0;
540                 }
541         }
542
543         pos /= 2;
544         pos += maxcol - col;
545
546         /* even pos -- handle attr+character pairs */
547         while (count > 1) {
548                 unsigned short w;
549
550                 w = get_unaligned(((unsigned short *)con_buf));
551                 vcs_scr_writew(vc, w, org++);
552                 con_buf += 2;
553                 count -= 2;
554                 if (++col == maxcol) {
555                         org = screen_pos(vc, pos, viewed);
556                         col = 0;
557                         pos += maxcol;
558                 }
559         }
560
561         if (!count)
562                 return org;
563
564         /* odd pos -- the remaining character */
565         c = *con_buf++;
566         vcs_scr_writew(vc, vc_compile_le16(vcs_scr_readw(vc, org) >> 8, c),
567                                 org);
568
569         return org;
570 }
571
572 static ssize_t
573 vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
574 {
575         struct inode *inode = file_inode(file);
576         struct vc_data *vc;
577         char *con_buf;
578         u16 *org0, *org;
579         unsigned int written;
580         int size;
581         ssize_t ret;
582         loff_t pos;
583         bool viewed, attr;
584
585         if (use_unicode(inode))
586                 return -EOPNOTSUPP;
587
588         con_buf = (char *) __get_free_page(GFP_KERNEL);
589         if (!con_buf)
590                 return -ENOMEM;
591
592         pos = *ppos;
593
594         /* Select the proper current console and verify
595          * sanity of the situation under the console lock.
596          */
597         console_lock();
598
599         attr = use_attributes(inode);
600         ret = -ENXIO;
601         vc = vcs_vc(inode, &viewed);
602         if (!vc)
603                 goto unlock_out;
604
605         size = vcs_size(vc, attr, false);
606         if (size < 0) {
607                 ret = size;
608                 goto unlock_out;
609         }
610         ret = -EINVAL;
611         if (pos < 0 || pos > size)
612                 goto unlock_out;
613         if (count > size - pos)
614                 count = size - pos;
615         written = 0;
616         while (count) {
617                 unsigned int this_round = count;
618
619                 if (this_round > CON_BUF_SIZE)
620                         this_round = CON_BUF_SIZE;
621
622                 /* Temporarily drop the console lock so that we can read
623                  * in the write data from userspace safely.
624                  */
625                 console_unlock();
626                 ret = copy_from_user(con_buf, buf, this_round);
627                 console_lock();
628
629                 if (ret) {
630                         this_round -= ret;
631                         if (!this_round) {
632                                 /* Abort loop if no data were copied. Otherwise
633                                  * fail with -EFAULT.
634                                  */
635                                 if (written)
636                                         break;
637                                 ret = -EFAULT;
638                                 goto unlock_out;
639                         }
640                 }
641
642                 /* The vcs_size might have changed while we slept to grab
643                  * the user buffer, so recheck.
644                  * Return data written up to now on failure.
645                  */
646                 size = vcs_size(vc, attr, false);
647                 if (size < 0) {
648                         if (written)
649                                 break;
650                         ret = size;
651                         goto unlock_out;
652                 }
653                 if (pos >= size)
654                         break;
655                 if (this_round > size - pos)
656                         this_round = size - pos;
657
658                 /* OK, now actually push the write to the console
659                  * under the lock using the local kernel buffer.
660                  */
661
662                 if (attr)
663                         org = vcs_write_buf(vc, con_buf, pos, this_round,
664                                         viewed, &org0);
665                 else
666                         org = vcs_write_buf_noattr(vc, con_buf, pos, this_round,
667                                         viewed, &org0);
668
669                 count -= this_round;
670                 written += this_round;
671                 buf += this_round;
672                 pos += this_round;
673                 if (org)
674                         update_region(vc, (unsigned long)(org0), org - org0);
675         }
676         *ppos += written;
677         ret = written;
678         if (written)
679                 vcs_scr_updated(vc);
680
681 unlock_out:
682         console_unlock();
683         free_page((unsigned long) con_buf);
684         return ret;
685 }
686
687 static __poll_t
688 vcs_poll(struct file *file, poll_table *wait)
689 {
690         struct vcs_poll_data *poll = vcs_poll_data_get(file);
691         __poll_t ret = DEFAULT_POLLMASK|EPOLLERR;
692
693         if (poll) {
694                 poll_wait(file, &poll->waitq, wait);
695                 switch (poll->event) {
696                 case VT_UPDATE:
697                         ret = DEFAULT_POLLMASK|EPOLLPRI;
698                         break;
699                 case VT_DEALLOCATE:
700                         ret = DEFAULT_POLLMASK|EPOLLHUP|EPOLLERR;
701                         break;
702                 case 0:
703                         ret = DEFAULT_POLLMASK;
704                         break;
705                 }
706         }
707         return ret;
708 }
709
710 static int
711 vcs_fasync(int fd, struct file *file, int on)
712 {
713         struct vcs_poll_data *poll = file->private_data;
714
715         if (!poll) {
716                 /* don't allocate anything if all we want is disable fasync */
717                 if (!on)
718                         return 0;
719                 poll = vcs_poll_data_get(file);
720                 if (!poll)
721                         return -ENOMEM;
722         }
723
724         return fasync_helper(fd, file, on, &poll->fasync);
725 }
726
727 static int
728 vcs_open(struct inode *inode, struct file *filp)
729 {
730         unsigned int currcons = console(inode);
731         bool attr = use_attributes(inode);
732         bool uni_mode = use_unicode(inode);
733         int ret = 0;
734
735         /* we currently don't support attributes in unicode mode */
736         if (attr && uni_mode)
737                 return -EOPNOTSUPP;
738
739         console_lock();
740         if(currcons && !vc_cons_allocated(currcons-1))
741                 ret = -ENXIO;
742         console_unlock();
743         return ret;
744 }
745
746 static int vcs_release(struct inode *inode, struct file *file)
747 {
748         struct vcs_poll_data *poll = file->private_data;
749
750         if (poll)
751                 vcs_poll_data_free(poll);
752         return 0;
753 }
754
755 static const struct file_operations vcs_fops = {
756         .llseek         = vcs_lseek,
757         .read           = vcs_read,
758         .write          = vcs_write,
759         .poll           = vcs_poll,
760         .fasync         = vcs_fasync,
761         .open           = vcs_open,
762         .release        = vcs_release,
763 };
764
765 static struct class *vc_class;
766
767 void vcs_make_sysfs(int index)
768 {
769         device_create(vc_class, NULL, MKDEV(VCS_MAJOR, index + 1), NULL,
770                       "vcs%u", index + 1);
771         device_create(vc_class, NULL, MKDEV(VCS_MAJOR, index + 65), NULL,
772                       "vcsu%u", index + 1);
773         device_create(vc_class, NULL, MKDEV(VCS_MAJOR, index + 129), NULL,
774                       "vcsa%u", index + 1);
775 }
776
777 void vcs_remove_sysfs(int index)
778 {
779         device_destroy(vc_class, MKDEV(VCS_MAJOR, index + 1));
780         device_destroy(vc_class, MKDEV(VCS_MAJOR, index + 65));
781         device_destroy(vc_class, MKDEV(VCS_MAJOR, index + 129));
782 }
783
784 int __init vcs_init(void)
785 {
786         unsigned int i;
787
788         if (register_chrdev(VCS_MAJOR, "vcs", &vcs_fops))
789                 panic("unable to get major %d for vcs device", VCS_MAJOR);
790         vc_class = class_create(THIS_MODULE, "vc");
791
792         device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 0), NULL, "vcs");
793         device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 64), NULL, "vcsu");
794         device_create(vc_class, NULL, MKDEV(VCS_MAJOR, 128), NULL, "vcsa");
795         for (i = 0; i < MIN_NR_CONSOLES; i++)
796                 vcs_make_sysfs(i);
797         return 0;
798 }