Lines Matching +full:ultra +full:- +full:compact
1 // SPDX-License-Identifier: GPL-2.0
5 * Mapping from internal code (such as Latin-1 or Unicode or IBM PC code)
10 * Support for multiple unimaps by Jakub Jelinek <jj@ultra.linux.cz>, July 1998
15 * &mm->mmap_lock --> cpu_hotplug.lock --> console_lock --> &mm->mmap_lock
42 /* 8-bit Latin-1 mapped to Unicode -- trivial mapping */
147 /* User mapping -- default to codes for direct font mapping */
184 /* The standard kernel character-to-font mappings are not invertible
185 -- this is just a best effort. */
208 * struct uni_pagedict - unicode directory
213 * @inverse_translations: best-effort inverse mapping
214 * @inverse_trans_unicode: best-effort inverse mapping to unicode
234 inv = dict->inverse_translations[m]; in set_inverse_transl()
237 inv = dict->inverse_translations[m] = kmalloc(MAX_GLYPH, in set_inverse_transl()
247 /* prefer '-' above SHY etc. */ in set_inverse_transl()
261 inv = dict->inverse_trans_unicode; in set_inverse_trans_unicode()
263 inv = dict->inverse_trans_unicode = kmalloc_array(MAX_GLYPH, in set_inverse_trans_unicode()
271 u16 **dir = dict->uni_pgdir[d]; in set_inverse_trans_unicode()
289 inv_translate[vc->vc_num] = m; in set_translate()
295 * 1. The font<->character maps are not 1-1.
298 * Still, it is now possible to a certain extent to cut and paste non-ASCII.
308 p = *conp->uni_pagedict_loc; in inverse_translate()
313 if (!p->inverse_trans_unicode) in inverse_translate()
316 return p->inverse_trans_unicode[glyph]; in inverse_translate()
319 m = inv_translate[conp->vc_num]; in inverse_translate()
320 if (!p->inverse_translations[m]) in inverse_translate()
323 return p->inverse_translations[m][glyph]; in inverse_translate()
335 p = *vc_cons[i].d->uni_pagedict_loc; in update_user_maps()
349 * 0xf000-0xf0ff "transparent" Unicodes) whereas the "new" variants set
360 return -EFAULT; in con_set_trans_old()
385 return copy_to_user(arg, outbuf, sizeof(outbuf)) ? -EFAULT : 0; in con_get_trans_old()
393 return -EFAULT; in con_set_trans_new()
410 return copy_to_user(arg, outbuf, sizeof(outbuf)) ? -EFAULT : 0; in con_get_trans_new()
414 * Unicode -> current font conversion
420 * this 3-level paged table scheme to be comparable to a hash table.
434 u16 **dir = dict->uni_pgdir[d]; in con_release_unimap()
440 dict->uni_pgdir[d] = NULL; in con_release_unimap()
443 for (r = 0; r < ARRAY_SIZE(dict->inverse_translations); r++) { in con_release_unimap()
444 kfree(dict->inverse_translations[r]); in con_release_unimap()
445 dict->inverse_translations[r] = NULL; in con_release_unimap()
448 kfree(dict->inverse_trans_unicode); in con_release_unimap()
449 dict->inverse_trans_unicode = NULL; in con_release_unimap()
457 p = *vc->uni_pagedict_loc; in con_free_unimap()
460 *vc->uni_pagedict_loc = NULL; in con_free_unimap()
461 if (--p->refcount) in con_free_unimap()
475 dict2 = *vc_cons[cons].d->uni_pagedict_loc; in con_unify_unimap()
476 if (!dict2 || dict2 == dict1 || dict2->sum != dict1->sum) in con_unify_unimap()
479 u16 **dir1 = dict1->uni_pgdir[d]; in con_unify_unimap()
480 u16 **dir2 = dict2->uni_pgdir[d]; in con_unify_unimap()
498 dict2->refcount++; in con_unify_unimap()
499 *conp->uni_pagedict_loc = dict2; in con_unify_unimap()
515 dir = p->uni_pgdir[n]; in con_insert_unipair()
517 dir = p->uni_pgdir[n] = kcalloc(UNI_DIR_ROWS, sizeof(*dir), in con_insert_unipair()
520 return -ENOMEM; in con_insert_unipair()
529 return -ENOMEM; in con_insert_unipair()
536 p->sum += (fontpos << 20U) + unicode; in con_insert_unipair()
543 struct uni_pagedict *new, *old = *vc->uni_pagedict_loc; in con_allocate_new()
547 return -ENOMEM; in con_allocate_new()
549 new->refcount = 1; in con_allocate_new()
550 *vc->uni_pagedict_loc = new; in con_allocate_new()
553 old->refcount--; in con_allocate_new()
561 struct uni_pagedict *old = *vc->uni_pagedict_loc; in con_do_clear_unimap()
563 if (!old || old->refcount > 1) in con_do_clear_unimap()
566 old->sum = 0; in con_do_clear_unimap()
593 new = *vc->uni_pagedict_loc; in con_unshare_unimap()
601 u16 **dir = old->uni_pgdir[d]; in con_unshare_unimap()
625 old->refcount++; in con_unshare_unimap()
626 *vc->uni_pagedict_loc = old; in con_unshare_unimap()
654 dict = *vc->uni_pagedict_loc; in con_set_unimap()
656 err = -EINVAL; in con_set_unimap()
660 if (dict->refcount > 1) { in con_set_unimap()
673 for (plist = unilist; ct; ct--, plist++) { in con_set_unimap()
674 err1 = con_insert_unipair(dict, plist->unicode, plist->fontpos); in con_set_unimap()
696 * con_set_default_unimap - set default unicode map
700 * The representation used was the most compact I could come up
714 dict = *vc->uni_pagedict_loc; in con_set_default_unimap()
718 dflt->refcount++; in con_set_default_unimap()
719 *vc->uni_pagedict_loc = dflt; in con_set_default_unimap()
720 if (dict && !--dict->refcount) { in con_set_default_unimap()
733 dict = *vc->uni_pagedict_loc; in con_set_default_unimap()
737 for (count = dfont_unicount[fontpos]; count; count--) { in con_set_default_unimap()
744 dflt = *vc->uni_pagedict_loc; in con_set_default_unimap()
757 * con_copy_unimap - copy unimap between two vts
767 if (!*src_vc->uni_pagedict_loc) in con_copy_unimap()
768 return -EINVAL; in con_copy_unimap()
769 if (*dst_vc->uni_pagedict_loc == *src_vc->uni_pagedict_loc) in con_copy_unimap()
772 src = *src_vc->uni_pagedict_loc; in con_copy_unimap()
773 src->refcount++; in con_copy_unimap()
774 *dst_vc->uni_pagedict_loc = src; in con_copy_unimap()
780 * con_get_unimap - get the unicode map
796 return -ENOMEM; in con_get_unimap()
801 dict = *vc->uni_pagedict_loc; in con_get_unimap()
806 u16 **dir = dict->uni_pgdir[d]; in con_get_unimap()
829 ret = -EFAULT; in con_get_unimap()
831 ret = -EFAULT; in con_get_unimap()
833 return ret ? ret : (ect <= ct) ? 0 : -ENOMEM; in con_get_unimap()
840 * direct-to-font mapping, then assume user is using Latin1.
860 return -1; in conv_uni_to_8bit()
868 /* Only 16-bit codes supported at this time */ in conv_uni_to_pc()
870 return -4; /* Not found */ in conv_uni_to_pc()
872 return -1; /* Not a printable character */ in conv_uni_to_pc()
874 return -2; /* Zero-width space */ in conv_uni_to_pc()
883 dict = *conp->uni_pagedict_loc; in conv_uni_to_pc()
885 return -3; in conv_uni_to_pc()
887 dir = dict->uni_pgdir[UNI_DIR(ucs)]; in conv_uni_to_pc()
889 return -4; in conv_uni_to_pc()
893 return -4; in conv_uni_to_pc()
897 return -4; in conv_uni_to_pc()
913 if (vc_cons_allocated(i) && !*vc_cons[i].d->uni_pagedict_loc) in console_map_init()