linux/drivers/tty/vt/selection.c

// SPDX-License-Identifier: GPL-2.0
/*
 * This module exports the functions:
 *
 *     'int set_selection_user(struct tiocl_selection __user *,
 *			       struct tty_struct *)'
 *     'int set_selection_kernel(struct tiocl_selection *, struct tty_struct *)'
 *     'void clear_selection(void)'
 *     'int paste_selection(struct tty_struct *)'
 *     'int sel_loadlut(u32 __user *)'
 *
 * Now that /dev/vcs exists, most of this can disappear again.
 */

#include <linux/module.h>
#include <linux/tty.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/types.h>

#include <linux/uaccess.h>

#include <linux/kbd_kern.h>
#include <linux/vt_kern.h>
#include <linux/consolemap.h>
#include <linux/selection.h>
#include <linux/tiocl.h>
#include <linux/console.h>
#include <linux/tty_flip.h>

#include <linux/sched/signal.h>

/* Don't take this from <ctype.h>: 011-015 on the screen aren't spaces */
#define is_space_on_vt(c)

/* FIXME: all this needs locking */
static struct vc_selection {} vc_sel =;

/* clear_selection, highlight and highlight_pointer can be called
   from interrupt (via scrollback/front) */

/* set reverse video on characters s-e of console with selection. */
static inline void highlight(const int s, const int e)
{}

/* use complementary color to show the pointer */
static inline void highlight_pointer(const int where)
{}

static u32
sel_pos(int n, bool unicode)
{}

/**
 * clear_selection - remove current selection
 *
 * Remove the current selection highlight, if any from the console holding the
 * selection.
 *
 * Locking: The caller must hold the console lock.
 */
void clear_selection(void)
{}
EXPORT_SYMBOL_GPL();

bool vc_is_sel(const struct vc_data *vc)
{}

/*
 * User settable table: what characters are to be considered alphabetic?
 * 128 bits. Locked by the console lock.
 */
static u32 inwordLut[]=;

static inline int inword(const u32 c)
{}

/**
 * sel_loadlut() - load the LUT table
 * @lut: user table
 *
 * Load the LUT table from user space. Make a temporary copy so a partial
 * update doesn't make a mess.
 *
 * Locking: The console lock is acquired.
 */
int sel_loadlut(u32 __user *lut)
{}

/* does screen address p correspond to character at LH/RH edge of screen? */
static inline int atedge(const int p, int size_row)
{}

/* stores the char in UTF8 and returns the number of bytes used (1-4) */
static int store_utf8(u32 c, char *p)
{}

/**
 * set_selection_user - set the current selection.
 * @sel: user selection info
 * @tty: the console tty
 *
 * Invoked by the ioctl handle for the vt layer.
 *
 * Locking: The entire selection process is managed under the console_lock.
 * It's a lot under the lock but its hardly a performance path.
 */
int set_selection_user(const struct tiocl_selection __user *sel,
		       struct tty_struct *tty)
{}

static int vc_selection_store_chars(struct vc_data *vc, bool unicode)
{}

static int vc_do_selection(struct vc_data *vc, unsigned short mode, int ps,
		int pe)
{}

static int vc_selection(struct vc_data *vc, struct tiocl_selection *v,
		struct tty_struct *tty)
{}

int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
{}
EXPORT_SYMBOL_GPL();

/* Insert the contents of the selection buffer into the
 * queue of the tty associated with the current console.
 * Invoked by ioctl().
 *
 * Locking: called without locks. Calls the ldisc wrongly with
 * unsafe methods,
 */
int paste_selection(struct tty_struct *tty)
{}
EXPORT_SYMBOL_GPL();