aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/include/shared
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
commitfcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch)
treea57612d1888735a2ec7972891b68c1ac5ec8faea /arch/um/include/shared
parent8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff)
Added missing tegra files.HEADmaster
Diffstat (limited to 'arch/um/include/shared')
-rw-r--r--arch/um/include/shared/chan_kern.h50
-rw-r--r--arch/um/include/shared/chan_user.h55
-rw-r--r--arch/um/include/shared/initrd.h12
-rw-r--r--arch/um/include/shared/ldt.h37
-rw-r--r--arch/um/include/shared/line.h106
-rw-r--r--arch/um/include/shared/mconsole.h98
-rw-r--r--arch/um/include/shared/mconsole_kern.h52
-rw-r--r--arch/um/include/shared/mem_kern.h20
-rw-r--r--arch/um/include/shared/process.h17
-rw-r--r--arch/um/include/shared/skas_ptregs.h6
-rw-r--r--arch/um/include/shared/syscall.h12
-rw-r--r--arch/um/include/shared/sysrq.h7
-rw-r--r--arch/um/include/shared/task.h9
-rw-r--r--arch/um/include/shared/tlb.h15
-rw-r--r--arch/um/include/shared/ubd_user.h16
-rw-r--r--arch/um/include/shared/um_mmu.h24
-rw-r--r--arch/um/include/shared/um_uaccess.h97
17 files changed, 633 insertions, 0 deletions
diff --git a/arch/um/include/shared/chan_kern.h b/arch/um/include/shared/chan_kern.h
new file mode 100644
index 00000000000..1e651457e04
--- /dev/null
+++ b/arch/um/include/shared/chan_kern.h
@@ -0,0 +1,50 @@
1/*
2 * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __CHAN_KERN_H__
7#define __CHAN_KERN_H__
8
9#include "linux/tty.h"
10#include "linux/list.h"
11#include "linux/console.h"
12#include "chan_user.h"
13#include "line.h"
14
15struct chan {
16 struct list_head list;
17 struct list_head free_list;
18 struct line *line;
19 char *dev;
20 unsigned int primary:1;
21 unsigned int input:1;
22 unsigned int output:1;
23 unsigned int opened:1;
24 unsigned int enabled:1;
25 int fd;
26 const struct chan_ops *ops;
27 void *data;
28};
29
30extern void chan_interrupt(struct list_head *chans, struct delayed_work *task,
31 struct tty_struct *tty, int irq);
32extern int parse_chan_pair(char *str, struct line *line, int device,
33 const struct chan_opts *opts, char **error_out);
34extern int write_chan(struct list_head *chans, const char *buf, int len,
35 int write_irq);
36extern int console_write_chan(struct list_head *chans, const char *buf,
37 int len);
38extern int console_open_chan(struct line *line, struct console *co);
39extern void deactivate_chan(struct list_head *chans, int irq);
40extern void reactivate_chan(struct list_head *chans, int irq);
41extern void chan_enable_winch(struct list_head *chans, struct tty_struct *tty);
42extern int enable_chan(struct line *line);
43extern void close_chan(struct list_head *chans, int delay_free_irq);
44extern int chan_window_size(struct list_head *chans,
45 unsigned short *rows_out,
46 unsigned short *cols_out);
47extern int chan_config_string(struct list_head *chans, char *str, int size,
48 char **error_out);
49
50#endif
diff --git a/arch/um/include/shared/chan_user.h b/arch/um/include/shared/chan_user.h
new file mode 100644
index 00000000000..9b9ced85b70
--- /dev/null
+++ b/arch/um/include/shared/chan_user.h
@@ -0,0 +1,55 @@
1/*
2 * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __CHAN_USER_H__
7#define __CHAN_USER_H__
8
9#include "init.h"
10
11struct chan_opts {
12 void (*const announce)(char *dev_name, int dev);
13 char *xterm_title;
14 const int raw;
15};
16
17enum chan_init_pri { INIT_STATIC, INIT_ALL, INIT_ONE };
18
19struct chan_ops {
20 char *type;
21 void *(*init)(char *, int, const struct chan_opts *);
22 int (*open)(int, int, int, void *, char **);
23 void (*close)(int, void *);
24 int (*read)(int, char *, void *);
25 int (*write)(int, const char *, int, void *);
26 int (*console_write)(int, const char *, int);
27 int (*window_size)(int, void *, unsigned short *, unsigned short *);
28 void (*free)(void *);
29 int winch;
30};
31
32extern const struct chan_ops fd_ops, null_ops, port_ops, pts_ops, pty_ops,
33 tty_ops, xterm_ops;
34
35extern void generic_close(int fd, void *unused);
36extern int generic_read(int fd, char *c_out, void *unused);
37extern int generic_write(int fd, const char *buf, int n, void *unused);
38extern int generic_console_write(int fd, const char *buf, int n);
39extern int generic_window_size(int fd, void *unused, unsigned short *rows_out,
40 unsigned short *cols_out);
41extern void generic_free(void *data);
42
43struct tty_struct;
44extern void register_winch(int fd, struct tty_struct *tty);
45extern void register_winch_irq(int fd, int tty_fd, int pid,
46 struct tty_struct *tty, unsigned long stack);
47
48#define __channel_help(fn, prefix) \
49__uml_help(fn, prefix "[0-9]*=<channel description>\n" \
50" Attach a console or serial line to a host channel. See\n" \
51" http://user-mode-linux.sourceforge.net/old/input.html for a complete\n" \
52" description of this switch.\n\n" \
53);
54
55#endif
diff --git a/arch/um/include/shared/initrd.h b/arch/um/include/shared/initrd.h
new file mode 100644
index 00000000000..22673bcc273
--- /dev/null
+++ b/arch/um/include/shared/initrd.h
@@ -0,0 +1,12 @@
1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __INITRD_USER_H__
7#define __INITRD_USER_H__
8
9extern int load_initrd(char *filename, void *buf, int size);
10
11#endif
12
diff --git a/arch/um/include/shared/ldt.h b/arch/um/include/shared/ldt.h
new file mode 100644
index 00000000000..a7f999a5877
--- /dev/null
+++ b/arch/um/include/shared/ldt.h
@@ -0,0 +1,37 @@
1/*
2 * Copyright (C) 2004 Fujitsu Siemens Computers GmbH
3 * Licensed under the GPL
4 *
5 * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
6 */
7
8#ifndef __ASM_LDT_H
9#define __ASM_LDT_H
10
11#include <linux/mutex.h>
12#include <sysdep/host_ldt.h>
13
14extern void ldt_host_info(void);
15
16#define LDT_PAGES_MAX \
17 ((LDT_ENTRIES * LDT_ENTRY_SIZE)/PAGE_SIZE)
18#define LDT_ENTRIES_PER_PAGE \
19 (PAGE_SIZE/LDT_ENTRY_SIZE)
20#define LDT_DIRECT_ENTRIES \
21 ((LDT_PAGES_MAX*sizeof(void *))/LDT_ENTRY_SIZE)
22
23struct ldt_entry {
24 __u32 a;
25 __u32 b;
26};
27
28typedef struct uml_ldt {
29 int entry_count;
30 struct mutex lock;
31 union {
32 struct ldt_entry * pages[LDT_PAGES_MAX];
33 struct ldt_entry entries[LDT_DIRECT_ENTRIES];
34 } u;
35} uml_ldt_t;
36
37#endif
diff --git a/arch/um/include/shared/line.h b/arch/um/include/shared/line.h
new file mode 100644
index 00000000000..63df3ca02ac
--- /dev/null
+++ b/arch/um/include/shared/line.h
@@ -0,0 +1,106 @@
1/*
2 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __LINE_H__
7#define __LINE_H__
8
9#include "linux/list.h"
10#include "linux/workqueue.h"
11#include "linux/tty.h"
12#include "linux/interrupt.h"
13#include "linux/spinlock.h"
14#include "linux/mutex.h"
15#include "chan_user.h"
16#include "mconsole_kern.h"
17
18/* There's only one modifiable field in this - .mc.list */
19struct line_driver {
20 const char *name;
21 const char *device_name;
22 const short major;
23 const short minor_start;
24 const short type;
25 const short subtype;
26 const int read_irq;
27 const char *read_irq_name;
28 const int write_irq;
29 const char *write_irq_name;
30 struct mc_device mc;
31};
32
33struct line {
34 struct tty_struct *tty;
35 spinlock_t count_lock;
36 unsigned long count;
37 int valid;
38
39 char *init_str;
40 int init_pri;
41 struct list_head chan_list;
42
43 /*This lock is actually, mostly, local to*/
44 spinlock_t lock;
45 int throttled;
46 /* Yes, this is a real circular buffer.
47 * XXX: And this should become a struct kfifo!
48 *
49 * buffer points to a buffer allocated on demand, of length
50 * LINE_BUFSIZE, head to the start of the ring, tail to the end.*/
51 char *buffer;
52 char *head;
53 char *tail;
54
55 int sigio;
56 struct delayed_work task;
57 const struct line_driver *driver;
58 int have_irq;
59};
60
61#define LINE_INIT(str, d) \
62 { .count_lock = __SPIN_LOCK_UNLOCKED((str).count_lock), \
63 .init_str = str, \
64 .init_pri = INIT_STATIC, \
65 .valid = 1, \
66 .lock = __SPIN_LOCK_UNLOCKED((str).lock), \
67 .driver = d }
68
69extern void line_close(struct tty_struct *tty, struct file * filp);
70extern int line_open(struct line *lines, struct tty_struct *tty);
71extern int line_setup(struct line *lines, unsigned int sizeof_lines,
72 char *init, char **error_out);
73extern int line_write(struct tty_struct *tty, const unsigned char *buf,
74 int len);
75extern int line_put_char(struct tty_struct *tty, unsigned char ch);
76extern void line_set_termios(struct tty_struct *tty, struct ktermios * old);
77extern int line_chars_in_buffer(struct tty_struct *tty);
78extern void line_flush_buffer(struct tty_struct *tty);
79extern void line_flush_chars(struct tty_struct *tty);
80extern int line_write_room(struct tty_struct *tty);
81extern int line_ioctl(struct tty_struct *tty, unsigned int cmd,
82 unsigned long arg);
83extern void line_throttle(struct tty_struct *tty);
84extern void line_unthrottle(struct tty_struct *tty);
85
86extern char *add_xterm_umid(char *base);
87extern int line_setup_irq(int fd, int input, int output, struct line *line,
88 void *data);
89extern void line_close_chan(struct line *line);
90extern struct tty_driver *register_lines(struct line_driver *line_driver,
91 const struct tty_operations *driver,
92 struct line *lines, int nlines);
93extern void lines_init(struct line *lines, int nlines, struct chan_opts *opts);
94extern void close_lines(struct line *lines, int nlines);
95
96extern int line_config(struct line *lines, unsigned int sizeof_lines,
97 char *str, const struct chan_opts *opts,
98 char **error_out);
99extern int line_id(char **str, int *start_out, int *end_out);
100extern int line_remove(struct line *lines, unsigned int sizeof_lines, int n,
101 char **error_out);
102extern int line_get_config(char *dev, struct line *lines,
103 unsigned int sizeof_lines, char *str,
104 int size, char **error_out);
105
106#endif
diff --git a/arch/um/include/shared/mconsole.h b/arch/um/include/shared/mconsole.h
new file mode 100644
index 00000000000..c139ae1d682
--- /dev/null
+++ b/arch/um/include/shared/mconsole.h
@@ -0,0 +1,98 @@
1/*
2 * Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org)
3 * Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
4 * Licensed under the GPL
5 */
6
7#ifndef __MCONSOLE_H__
8#define __MCONSOLE_H__
9
10#ifndef __KERNEL__
11#include <stdint.h>
12#define u32 uint32_t
13#endif
14
15#include "sysdep/ptrace.h"
16
17#define MCONSOLE_MAGIC (0xcafebabe)
18#define MCONSOLE_MAX_DATA (512)
19#define MCONSOLE_VERSION 2
20
21struct mconsole_request {
22 u32 magic;
23 u32 version;
24 u32 len;
25 char data[MCONSOLE_MAX_DATA];
26};
27
28struct mconsole_reply {
29 u32 err;
30 u32 more;
31 u32 len;
32 char data[MCONSOLE_MAX_DATA];
33};
34
35struct mconsole_notify {
36 u32 magic;
37 u32 version;
38 enum { MCONSOLE_SOCKET, MCONSOLE_PANIC, MCONSOLE_HANG,
39 MCONSOLE_USER_NOTIFY } type;
40 u32 len;
41 char data[MCONSOLE_MAX_DATA];
42};
43
44struct mc_request;
45
46enum mc_context { MCONSOLE_INTR, MCONSOLE_PROC };
47
48struct mconsole_command
49{
50 char *command;
51 void (*handler)(struct mc_request *req);
52 enum mc_context context;
53};
54
55struct mc_request
56{
57 int len;
58 int as_interrupt;
59
60 int originating_fd;
61 unsigned int originlen;
62 unsigned char origin[128]; /* sockaddr_un */
63
64 struct mconsole_request request;
65 struct mconsole_command *cmd;
66 struct uml_pt_regs regs;
67};
68
69extern char mconsole_socket_name[];
70
71extern int mconsole_unlink_socket(void);
72extern int mconsole_reply_len(struct mc_request *req, const char *reply,
73 int len, int err, int more);
74extern int mconsole_reply(struct mc_request *req, const char *str, int err,
75 int more);
76
77extern void mconsole_version(struct mc_request *req);
78extern void mconsole_help(struct mc_request *req);
79extern void mconsole_halt(struct mc_request *req);
80extern void mconsole_reboot(struct mc_request *req);
81extern void mconsole_config(struct mc_request *req);
82extern void mconsole_remove(struct mc_request *req);
83extern void mconsole_sysrq(struct mc_request *req);
84extern void mconsole_cad(struct mc_request *req);
85extern void mconsole_stop(struct mc_request *req);
86extern void mconsole_go(struct mc_request *req);
87extern void mconsole_log(struct mc_request *req);
88extern void mconsole_proc(struct mc_request *req);
89extern void mconsole_stack(struct mc_request *req);
90
91extern int mconsole_get_request(int fd, struct mc_request *req);
92extern int mconsole_notify(char *sock_name, int type, const void *data,
93 int len);
94extern char *mconsole_notify_socket(void);
95extern void lock_notify(void);
96extern void unlock_notify(void);
97
98#endif
diff --git a/arch/um/include/shared/mconsole_kern.h b/arch/um/include/shared/mconsole_kern.h
new file mode 100644
index 00000000000..d2fe07e7895
--- /dev/null
+++ b/arch/um/include/shared/mconsole_kern.h
@@ -0,0 +1,52 @@
1/*
2 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __MCONSOLE_KERN_H__
7#define __MCONSOLE_KERN_H__
8
9#include "linux/list.h"
10#include "mconsole.h"
11
12struct mconsole_entry {
13 struct list_head list;
14 struct mc_request request;
15};
16
17/* All these methods are called in process context. */
18struct mc_device {
19 struct list_head list;
20 char *name;
21 int (*config)(char *, char **);
22 int (*get_config)(char *, char *, int, char **);
23 int (*id)(char **, int *, int *);
24 int (*remove)(int, char **);
25};
26
27#define CONFIG_CHUNK(str, size, current, chunk, end) \
28do { \
29 current += strlen(chunk); \
30 if(current >= size) \
31 str = NULL; \
32 if(str != NULL){ \
33 strcpy(str, chunk); \
34 str += strlen(chunk); \
35 } \
36 if(end) \
37 current++; \
38} while(0)
39
40#ifdef CONFIG_MCONSOLE
41
42extern void mconsole_register_dev(struct mc_device *new);
43
44#else
45
46static inline void mconsole_register_dev(struct mc_device *new)
47{
48}
49
50#endif
51
52#endif
diff --git a/arch/um/include/shared/mem_kern.h b/arch/um/include/shared/mem_kern.h
new file mode 100644
index 00000000000..69be0fd0ce4
--- /dev/null
+++ b/arch/um/include/shared/mem_kern.h
@@ -0,0 +1,20 @@
1/*
2 * Copyright (C) 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __MEM_KERN_H__
7#define __MEM_KERN_H__
8
9#include "linux/list.h"
10#include "linux/types.h"
11
12struct remapper {
13 struct list_head list;
14 int (*proc)(int, unsigned long, int, __u64);
15};
16
17extern void register_remapper(struct remapper *info);
18
19#endif
20
diff --git a/arch/um/include/shared/process.h b/arch/um/include/shared/process.h
new file mode 100644
index 00000000000..bb873a51262
--- /dev/null
+++ b/arch/um/include/shared/process.h
@@ -0,0 +1,17 @@
1/*
2 * Copyright (C) 2000 - 2008 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __PROCESS_H__
7#define __PROCESS_H__
8
9#include <signal.h>
10
11/* Copied from linux/compiler-gcc.h since we can't include it directly */
12#define barrier() __asm__ __volatile__("": : :"memory")
13
14extern void sig_handler(int sig, struct sigcontext *sc);
15extern void alarm_handler(int sig, struct sigcontext *sc);
16
17#endif
diff --git a/arch/um/include/shared/skas_ptregs.h b/arch/um/include/shared/skas_ptregs.h
new file mode 100644
index 00000000000..73db19e9c07
--- /dev/null
+++ b/arch/um/include/shared/skas_ptregs.h
@@ -0,0 +1,6 @@
1#ifndef __SKAS_PT_REGS_
2#define __SKAS_PT_REGS_
3
4#include <user_constants.h>
5
6#endif
diff --git a/arch/um/include/shared/syscall.h b/arch/um/include/shared/syscall.h
new file mode 100644
index 00000000000..dda1df901a0
--- /dev/null
+++ b/arch/um/include/shared/syscall.h
@@ -0,0 +1,12 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SYSCALL_USER_H
7#define __SYSCALL_USER_H
8
9extern int record_syscall_start(int syscall);
10extern void record_syscall_end(int index, long result);
11
12#endif
diff --git a/arch/um/include/shared/sysrq.h b/arch/um/include/shared/sysrq.h
new file mode 100644
index 00000000000..c8d332b56b9
--- /dev/null
+++ b/arch/um/include/shared/sysrq.h
@@ -0,0 +1,7 @@
1#ifndef __UM_SYSRQ_H
2#define __UM_SYSRQ_H
3
4struct task_struct;
5extern void show_trace(struct task_struct* task, unsigned long *stack);
6
7#endif
diff --git a/arch/um/include/shared/task.h b/arch/um/include/shared/task.h
new file mode 100644
index 00000000000..3fe726b3cf4
--- /dev/null
+++ b/arch/um/include/shared/task.h
@@ -0,0 +1,9 @@
1#ifndef __TASK_H
2#define __TASK_H
3
4#include <kern_constants.h>
5
6#define TASK_REGS(task) ((struct uml_pt_regs *) &(((char *) (task))[HOST_TASK_REGS]))
7#define TASK_PID(task) *((int *) &(((char *) (task))[HOST_TASK_PID]))
8
9#endif
diff --git a/arch/um/include/shared/tlb.h b/arch/um/include/shared/tlb.h
new file mode 100644
index 00000000000..ecd2265b301
--- /dev/null
+++ b/arch/um/include/shared/tlb.h
@@ -0,0 +1,15 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __TLB_H__
7#define __TLB_H__
8
9#include "um_mmu.h"
10
11extern void force_flush_all(void);
12extern int flush_tlb_kernel_range_common(unsigned long start,
13 unsigned long end);
14
15#endif
diff --git a/arch/um/include/shared/ubd_user.h b/arch/um/include/shared/ubd_user.h
new file mode 100644
index 00000000000..3845051f1b1
--- /dev/null
+++ b/arch/um/include/shared/ubd_user.h
@@ -0,0 +1,16 @@
1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Copyright (C) 2001 RidgeRun, Inc (glonnon@ridgerun.com)
4 * Licensed under the GPL
5 */
6
7#ifndef __UM_UBD_USER_H
8#define __UM_UBD_USER_H
9
10extern void ignore_sigwinch_sig(void);
11extern int start_io_thread(unsigned long sp, int *fds_out);
12extern int io_thread(void *arg);
13extern int kernel_fd;
14
15#endif
16
diff --git a/arch/um/include/shared/um_mmu.h b/arch/um/include/shared/um_mmu.h
new file mode 100644
index 00000000000..b1a7e47d102
--- /dev/null
+++ b/arch/um/include/shared/um_mmu.h
@@ -0,0 +1,24 @@
1/*
2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __ARCH_UM_MMU_H
7#define __ARCH_UM_MMU_H
8
9#include "mm_id.h"
10#include "ldt.h"
11
12typedef struct mm_context {
13 struct mm_id id;
14 struct uml_ldt ldt;
15 struct page **stub_pages;
16} mm_context_t;
17
18extern void __switch_mm(struct mm_id * mm_idp);
19
20/* Avoid tangled inclusion with asm/ldt.h */
21extern long init_new_ldt(struct mm_context *to_mm, struct mm_context *from_mm);
22extern void free_ldt(struct mm_context *mm);
23
24#endif
diff --git a/arch/um/include/shared/um_uaccess.h b/arch/um/include/shared/um_uaccess.h
new file mode 100644
index 00000000000..45c04999d67
--- /dev/null
+++ b/arch/um/include/shared/um_uaccess.h
@@ -0,0 +1,97 @@
1/*
2 * Copyright (C) 2002 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __ARCH_UM_UACCESS_H
7#define __ARCH_UM_UACCESS_H
8
9#include <asm/elf.h>
10#include <asm/fixmap.h>
11#include "sysdep/archsetjmp.h"
12
13#define __under_task_size(addr, size) \
14 (((unsigned long) (addr) < TASK_SIZE) && \
15 (((unsigned long) (addr) + (size)) < TASK_SIZE))
16
17#define __access_ok_vsyscall(type, addr, size) \
18 ((type == VERIFY_READ) && \
19 ((unsigned long) (addr) >= FIXADDR_USER_START) && \
20 ((unsigned long) (addr) + (size) <= FIXADDR_USER_END) && \
21 ((unsigned long) (addr) + (size) >= (unsigned long)(addr)))
22
23#define __addr_range_nowrap(addr, size) \
24 ((unsigned long) (addr) <= ((unsigned long) (addr) + (size)))
25
26#define access_ok(type, addr, size) \
27 (__addr_range_nowrap(addr, size) && \
28 (__under_task_size(addr, size) || \
29 __access_ok_vsyscall(type, addr, size) || \
30 segment_eq(get_fs(), KERNEL_DS)))
31
32extern int copy_from_user(void *to, const void __user *from, int n);
33extern int copy_to_user(void __user *to, const void *from, int n);
34
35extern int __do_copy_to_user(void *to, const void *from, int n,
36 void **fault_addr, jmp_buf **fault_catcher);
37
38/*
39 * strncpy_from_user: - Copy a NUL terminated string from userspace.
40 * @dst: Destination address, in kernel space. This buffer must be at
41 * least @count bytes long.
42 * @src: Source address, in user space.
43 * @count: Maximum number of bytes to copy, including the trailing NUL.
44 *
45 * Copies a NUL-terminated string from userspace to kernel space.
46 *
47 * On success, returns the length of the string (not including the trailing
48 * NUL).
49 *
50 * If access to userspace fails, returns -EFAULT (some data may have been
51 * copied).
52 *
53 * If @count is smaller than the length of the string, copies @count bytes
54 * and returns @count.
55 */
56
57extern int strncpy_from_user(char *dst, const char __user *src, int count);
58
59/*
60 * __clear_user: - Zero a block of memory in user space, with less checking.
61 * @to: Destination address, in user space.
62 * @n: Number of bytes to zero.
63 *
64 * Zero a block of memory in user space. Caller must check
65 * the specified block with access_ok() before calling this function.
66 *
67 * Returns number of bytes that could not be cleared.
68 * On success, this will be zero.
69 */
70extern int __clear_user(void __user *mem, int len);
71
72/*
73 * clear_user: - Zero a block of memory in user space.
74 * @to: Destination address, in user space.
75 * @n: Number of bytes to zero.
76 *
77 * Zero a block of memory in user space.
78 *
79 * Returns number of bytes that could not be cleared.
80 * On success, this will be zero.
81 */
82extern int clear_user(void __user *mem, int len);
83
84/*
85 * strlen_user: - Get the size of a string in user space.
86 * @str: The string to measure.
87 * @n: The maximum valid length
88 *
89 * Get the size of a NUL-terminated string in user space.
90 *
91 * Returns the size of the string INCLUDING the terminating NUL.
92 * On exception, returns 0.
93 * If the string is too long, returns a value greater than @n.
94 */
95extern int strnlen_user(const void __user *str, int len);
96
97#endif