Merge branch 'for-linus' of git://github.com/richardweinberger/linux

* 'for-linus' of git://github.com/richardweinberger/linux: (90 commits)
  um: fix ubd cow size
  um: Fix kmalloc argument order in um/vdso/vma.c
  um: switch to use of drivers/Kconfig
  UserModeLinux-HOWTO.txt: fix a typo
  UserModeLinux-HOWTO.txt: remove ^H characters
  um: we need sys/user.h only on i386
  um: merge delay_{32,64}.c
  um: distribute exports to where exported stuff is defined
  um: kill system-um.h
  um: generic ftrace.h will do...
  um: segment.h is x86-only and needed only there
  um: asm/pda.h is not needed anymore
  um: hw_irq.h can go generic as well
  um: switch to generic-y
  um: clean Kconfig up a bit
  um: a couple of missing dependencies...
  um: kill useless argument of free_chan() and free_one_chan()
  um: unify ptrace_user.h
  um: unify KSTK_...
  um: fix gcov build breakage
  ...
This commit is contained in:
Linus Torvalds
2011-11-02 09:45:39 -07:00
commit de0a5345a5
253 muutettua tiedostoa jossa 1672 lisäystä ja 3332 poistoa

50
arch/um/drivers/chan.h Normal file
Näytä tiedosto

@@ -0,0 +1,50 @@
/*
* Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
#ifndef __CHAN_KERN_H__
#define __CHAN_KERN_H__
#include <linux/tty.h>
#include <linux/list.h>
#include <linux/console.h>
#include "chan_user.h"
#include "line.h"
struct chan {
struct list_head list;
struct list_head free_list;
struct line *line;
char *dev;
unsigned int primary:1;
unsigned int input:1;
unsigned int output:1;
unsigned int opened:1;
unsigned int enabled:1;
int fd;
const struct chan_ops *ops;
void *data;
};
extern void chan_interrupt(struct list_head *chans, struct delayed_work *task,
struct tty_struct *tty, int irq);
extern int parse_chan_pair(char *str, struct line *line, int device,
const struct chan_opts *opts, char **error_out);
extern int write_chan(struct list_head *chans, const char *buf, int len,
int write_irq);
extern int console_write_chan(struct list_head *chans, const char *buf,
int len);
extern int console_open_chan(struct line *line, struct console *co);
extern void deactivate_chan(struct list_head *chans, int irq);
extern void reactivate_chan(struct list_head *chans, int irq);
extern void chan_enable_winch(struct list_head *chans, struct tty_struct *tty);
extern int enable_chan(struct line *line);
extern void close_chan(struct list_head *chans, int delay_free_irq);
extern int chan_window_size(struct list_head *chans,
unsigned short *rows_out,
unsigned short *cols_out);
extern int chan_config_string(struct list_head *chans, char *str, int size,
char **error_out);
#endif

Näytä tiedosto

@@ -6,7 +6,7 @@
#include <linux/slab.h>
#include <linux/tty.h>
#include <linux/tty_flip.h>
#include "chan_kern.h"
#include "chan.h"
#include "os.h"
#ifdef CONFIG_NOCONFIG_CHAN
@@ -358,11 +358,11 @@ int chan_window_size(struct list_head *chans, unsigned short *rows_out,
return 0;
}
static void free_one_chan(struct chan *chan, int delay_free_irq)
static void free_one_chan(struct chan *chan)
{
list_del(&chan->list);
close_one_chan(chan, delay_free_irq);
close_one_chan(chan, 0);
if (chan->ops->free != NULL)
(*chan->ops->free)(chan->data);
@@ -372,14 +372,14 @@ static void free_one_chan(struct chan *chan, int delay_free_irq)
kfree(chan);
}
static void free_chan(struct list_head *chans, int delay_free_irq)
static void free_chan(struct list_head *chans)
{
struct list_head *ele, *next;
struct chan *chan;
list_for_each_safe(ele, next, chans) {
chan = list_entry(ele, struct chan, list);
free_one_chan(chan, delay_free_irq);
free_one_chan(chan);
}
}
@@ -547,7 +547,7 @@ int parse_chan_pair(char *str, struct line *line, int device,
char *in, *out;
if (!list_empty(chans)) {
free_chan(chans, 0);
free_chan(chans);
INIT_LIST_HEAD(chans);
}

Näytä tiedosto

@@ -11,10 +11,8 @@
#include <termios.h>
#include <sys/ioctl.h>
#include "chan_user.h"
#include "kern_constants.h"
#include "os.h"
#include "um_malloc.h"
#include "user.h"
void generic_close(int fd, void *unused)
{
@@ -283,7 +281,12 @@ void register_winch(int fd, struct tty_struct *tty)
return;
pid = tcgetpgrp(fd);
if (!is_skas_winch(pid, fd, tty) && (pid == -1)) {
if (is_skas_winch(pid, fd, tty)) {
register_winch_irq(-1, fd, -1, tty, 0);
return;
}
if (pid == -1) {
thread = winch_tramp(fd, tty, &thread_fd, &stack);
if (thread < 0)
return;

Näytä tiedosto

@@ -0,0 +1,55 @@
/*
* Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
#ifndef __CHAN_USER_H__
#define __CHAN_USER_H__
#include "init.h"
struct chan_opts {
void (*const announce)(char *dev_name, int dev);
char *xterm_title;
const int raw;
};
enum chan_init_pri { INIT_STATIC, INIT_ALL, INIT_ONE };
struct chan_ops {
char *type;
void *(*init)(char *, int, const struct chan_opts *);
int (*open)(int, int, int, void *, char **);
void (*close)(int, void *);
int (*read)(int, char *, void *);
int (*write)(int, const char *, int, void *);
int (*console_write)(int, const char *, int);
int (*window_size)(int, void *, unsigned short *, unsigned short *);
void (*free)(void *);
int winch;
};
extern const struct chan_ops fd_ops, null_ops, port_ops, pts_ops, pty_ops,
tty_ops, xterm_ops;
extern void generic_close(int fd, void *unused);
extern int generic_read(int fd, char *c_out, void *unused);
extern int generic_write(int fd, const char *buf, int n, void *unused);
extern int generic_console_write(int fd, const char *buf, int n);
extern int generic_window_size(int fd, void *unused, unsigned short *rows_out,
unsigned short *cols_out);
extern void generic_free(void *data);
struct tty_struct;
extern void register_winch(int fd, struct tty_struct *tty);
extern void register_winch_irq(int fd, int tty_fd, int pid,
struct tty_struct *tty, unsigned long stack);
#define __channel_help(fn, prefix) \
__uml_help(fn, prefix "[0-9]*=<channel description>\n" \
" Attach a console or serial line to a host channel. See\n" \
" http://user-mode-linux.sourceforge.net/old/input.html for a complete\n" \
" description of this switch.\n\n" \
);
#endif

Näytä tiedosto

@@ -3,7 +3,6 @@
#include "kern_util.h"
#include "os.h"
#include "user.h"
#include "um_malloc.h"
static inline void *cow_malloc(int size)

Näytä tiedosto

@@ -17,7 +17,6 @@
#include "net_user.h"
#include "os.h"
#include "um_malloc.h"
#include "user.h"
enum request_type { REQ_NEW_CONTROL };

Näytä tiedosto

@@ -9,10 +9,8 @@
#include <errno.h>
#include <termios.h>
#include "chan_user.h"
#include "kern_constants.h"
#include "os.h"
#include "um_malloc.h"
#include "user.h"
struct fd_chan {
int fd;

Näytä tiedosto

@@ -7,7 +7,6 @@
#include <unistd.h>
#include <errno.h>
#include "os.h"
#include "user.h"
struct dog_data {
int stdin;

Näytä tiedosto

@@ -7,7 +7,7 @@
#include "linux/kd.h"
#include "linux/sched.h"
#include "linux/slab.h"
#include "chan_kern.h"
#include "chan.h"
#include "irq_kern.h"
#include "irq_user.h"
#include "kern_util.h"

106
arch/um/drivers/line.h Normal file
Näytä tiedosto

@@ -0,0 +1,106 @@
/*
* Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
#ifndef __LINE_H__
#define __LINE_H__
#include "linux/list.h"
#include "linux/workqueue.h"
#include "linux/tty.h"
#include "linux/interrupt.h"
#include "linux/spinlock.h"
#include "linux/mutex.h"
#include "chan_user.h"
#include "mconsole_kern.h"
/* There's only one modifiable field in this - .mc.list */
struct line_driver {
const char *name;
const char *device_name;
const short major;
const short minor_start;
const short type;
const short subtype;
const int read_irq;
const char *read_irq_name;
const int write_irq;
const char *write_irq_name;
struct mc_device mc;
};
struct line {
struct tty_struct *tty;
spinlock_t count_lock;
unsigned long count;
int valid;
char *init_str;
int init_pri;
struct list_head chan_list;
/*This lock is actually, mostly, local to*/
spinlock_t lock;
int throttled;
/* Yes, this is a real circular buffer.
* XXX: And this should become a struct kfifo!
*
* buffer points to a buffer allocated on demand, of length
* LINE_BUFSIZE, head to the start of the ring, tail to the end.*/
char *buffer;
char *head;
char *tail;
int sigio;
struct delayed_work task;
const struct line_driver *driver;
int have_irq;
};
#define LINE_INIT(str, d) \
{ .count_lock = __SPIN_LOCK_UNLOCKED((str).count_lock), \
.init_str = str, \
.init_pri = INIT_STATIC, \
.valid = 1, \
.lock = __SPIN_LOCK_UNLOCKED((str).lock), \
.driver = d }
extern void line_close(struct tty_struct *tty, struct file * filp);
extern int line_open(struct line *lines, struct tty_struct *tty);
extern int line_setup(struct line *lines, unsigned int sizeof_lines,
char *init, char **error_out);
extern int line_write(struct tty_struct *tty, const unsigned char *buf,
int len);
extern int line_put_char(struct tty_struct *tty, unsigned char ch);
extern void line_set_termios(struct tty_struct *tty, struct ktermios * old);
extern int line_chars_in_buffer(struct tty_struct *tty);
extern void line_flush_buffer(struct tty_struct *tty);
extern void line_flush_chars(struct tty_struct *tty);
extern int line_write_room(struct tty_struct *tty);
extern int line_ioctl(struct tty_struct *tty, unsigned int cmd,
unsigned long arg);
extern void line_throttle(struct tty_struct *tty);
extern void line_unthrottle(struct tty_struct *tty);
extern char *add_xterm_umid(char *base);
extern int line_setup_irq(int fd, int input, int output, struct line *line,
void *data);
extern void line_close_chan(struct line *line);
extern struct tty_driver *register_lines(struct line_driver *line_driver,
const struct tty_operations *driver,
struct line *lines, int nlines);
extern void lines_init(struct line *lines, int nlines, struct chan_opts *opts);
extern void close_lines(struct line *lines, int nlines);
extern int line_config(struct line *lines, unsigned int sizeof_lines,
char *str, const struct chan_opts *opts,
char **error_out);
extern int line_id(char **str, int *start_out, int *end_out);
extern int line_remove(struct line *lines, unsigned int sizeof_lines, int n,
char **error_out);
extern int line_get_config(char *dev, struct line *lines,
unsigned int sizeof_lines, char *str,
int size, char **error_out);
#endif

Näytä tiedosto

@@ -0,0 +1,98 @@
/*
* Copyright (C) 2001 Lennert Buytenhek (buytenh@gnu.org)
* Copyright (C) 2001 - 2007 Jeff Dike (jdike@{addtoit,linux.intel}.com)
* Licensed under the GPL
*/
#ifndef __MCONSOLE_H__
#define __MCONSOLE_H__
#ifndef __KERNEL__
#include <stdint.h>
#define u32 uint32_t
#endif
#include "sysdep/ptrace.h"
#define MCONSOLE_MAGIC (0xcafebabe)
#define MCONSOLE_MAX_DATA (512)
#define MCONSOLE_VERSION 2
struct mconsole_request {
u32 magic;
u32 version;
u32 len;
char data[MCONSOLE_MAX_DATA];
};
struct mconsole_reply {
u32 err;
u32 more;
u32 len;
char data[MCONSOLE_MAX_DATA];
};
struct mconsole_notify {
u32 magic;
u32 version;
enum { MCONSOLE_SOCKET, MCONSOLE_PANIC, MCONSOLE_HANG,
MCONSOLE_USER_NOTIFY } type;
u32 len;
char data[MCONSOLE_MAX_DATA];
};
struct mc_request;
enum mc_context { MCONSOLE_INTR, MCONSOLE_PROC };
struct mconsole_command
{
char *command;
void (*handler)(struct mc_request *req);
enum mc_context context;
};
struct mc_request
{
int len;
int as_interrupt;
int originating_fd;
unsigned int originlen;
unsigned char origin[128]; /* sockaddr_un */
struct mconsole_request request;
struct mconsole_command *cmd;
struct uml_pt_regs regs;
};
extern char mconsole_socket_name[];
extern int mconsole_unlink_socket(void);
extern int mconsole_reply_len(struct mc_request *req, const char *reply,
int len, int err, int more);
extern int mconsole_reply(struct mc_request *req, const char *str, int err,
int more);
extern void mconsole_version(struct mc_request *req);
extern void mconsole_help(struct mc_request *req);
extern void mconsole_halt(struct mc_request *req);
extern void mconsole_reboot(struct mc_request *req);
extern void mconsole_config(struct mc_request *req);
extern void mconsole_remove(struct mc_request *req);
extern void mconsole_sysrq(struct mc_request *req);
extern void mconsole_cad(struct mc_request *req);
extern void mconsole_stop(struct mc_request *req);
extern void mconsole_go(struct mc_request *req);
extern void mconsole_log(struct mc_request *req);
extern void mconsole_proc(struct mc_request *req);
extern void mconsole_stack(struct mc_request *req);
extern int mconsole_get_request(int fd, struct mc_request *req);
extern int mconsole_notify(char *sock_name, int type, const void *data,
int len);
extern char *mconsole_notify_socket(void);
extern void lock_notify(void);
extern void unlock_notify(void);
#endif

Näytä tiedosto

@@ -0,0 +1,52 @@
/*
* Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
#ifndef __MCONSOLE_KERN_H__
#define __MCONSOLE_KERN_H__
#include "linux/list.h"
#include "mconsole.h"
struct mconsole_entry {
struct list_head list;
struct mc_request request;
};
/* All these methods are called in process context. */
struct mc_device {
struct list_head list;
char *name;
int (*config)(char *, char **);
int (*get_config)(char *, char *, int, char **);
int (*id)(char **, int *, int *);
int (*remove)(int, char **);
};
#define CONFIG_CHUNK(str, size, current, chunk, end) \
do { \
current += strlen(chunk); \
if(current >= size) \
str = NULL; \
if(str != NULL){ \
strcpy(str, chunk); \
str += strlen(chunk); \
} \
if(end) \
current++; \
} while(0)
#ifdef CONFIG_MCONSOLE
extern void mconsole_register_dev(struct mc_device *new);
#else
static inline void mconsole_register_dev(struct mc_device *new)
{
}
#endif
#endif

Näytä tiedosto

@@ -10,9 +10,7 @@
#include <sys/socket.h>
#include <sys/uio.h>
#include <sys/un.h>
#include "kern_constants.h"
#include "mconsole.h"
#include "user.h"
static struct mconsole_command commands[] = {
/*

Näytä tiedosto

@@ -12,10 +12,8 @@
#include <sys/socket.h>
#include <sys/wait.h>
#include "net_user.h"
#include "kern_constants.h"
#include "os.h"
#include "um_malloc.h"
#include "user.h"
int tap_open_common(void *dev, char *gate_addr)
{

Näytä tiedosto

@@ -9,9 +9,7 @@
#include <asm/types.h>
#include "net_user.h"
#include "pcap_user.h"
#include "kern_constants.h"
#include "um_malloc.h"
#include "user.h"
#define PCAP_FD(p) (*(int *)(p))

Näytä tiedosto

@@ -10,11 +10,9 @@
#include <unistd.h>
#include <netinet/in.h>
#include "chan_user.h"
#include "kern_constants.h"
#include "os.h"
#include "port.h"
#include "um_malloc.h"
#include "user.h"
struct port_chan {
int raw;

Näytä tiedosto

@@ -12,10 +12,8 @@
#include <termios.h>
#include <sys/stat.h>
#include "chan_user.h"
#include "kern_constants.h"
#include "os.h"
#include "um_malloc.h"
#include "user.h"
struct pty_chan {
void (*announce)(char *dev_name, int dev);

Näytä tiedosto

@@ -11,12 +11,10 @@
#include <string.h>
#include <sys/termios.h>
#include <sys/wait.h>
#include "kern_constants.h"
#include "net_user.h"
#include "os.h"
#include "slip.h"
#include "um_malloc.h"
#include "user.h"
static int slip_user_init(void *data, void *dev)
{

Näytä tiedosto

@@ -7,11 +7,9 @@
#include <errno.h>
#include <string.h>
#include <sys/wait.h>
#include "kern_constants.h"
#include "net_user.h"
#include "os.h"
#include "slirp.h"
#include "user.h"
static int slirp_user_init(void *data, void *dev)
{

Näytä tiedosto

@@ -12,10 +12,8 @@
#include "linux/console.h"
#include "asm/termbits.h"
#include "asm/irq.h"
#include "line.h"
#include "ssl.h"
#include "chan_kern.h"
#include "kern.h"
#include "chan.h"
#include "init.h"
#include "irq_user.h"
#include "mconsole_kern.h"

Näytä tiedosto

@@ -20,8 +20,7 @@
#include "asm/current.h"
#include "asm/irq.h"
#include "stdio_console.h"
#include "line.h"
#include "chan_kern.h"
#include "chan.h"
#include "irq_user.h"
#include "mconsole_kern.h"
#include "init.h"

Näytä tiedosto

@@ -7,10 +7,8 @@
#include <fcntl.h>
#include <termios.h>
#include "chan_user.h"
#include "kern_constants.h"
#include "os.h"
#include "um_malloc.h"
#include "user.h"
struct tty_chan {
char *dev;

Näytä tiedosto

@@ -46,7 +46,6 @@
#include "asm/tlbflush.h"
#include "mem_user.h"
#include "kern_util.h"
#include "kern.h"
#include "mconsole_kern.h"
#include "init.h"
#include "irq_user.h"
@@ -54,7 +53,6 @@
#include "ubd_user.h"
#include "os.h"
#include "mem.h"
#include "mem_kern.h"
#include "cow.h"
enum ubd_req { UBD_READ, UBD_WRITE };
@@ -513,8 +511,37 @@ __uml_exitcall(kill_io_thread);
static inline int ubd_file_size(struct ubd *ubd_dev, __u64 *size_out)
{
char *file;
int fd;
int err;
file = ubd_dev->cow.file ? ubd_dev->cow.file : ubd_dev->file;
__u32 version;
__u32 align;
char *backing_file;
time_t mtime;
unsigned long long size;
int sector_size;
int bitmap_offset;
if (ubd_dev->file && ubd_dev->cow.file) {
file = ubd_dev->cow.file;
goto out;
}
fd = os_open_file(ubd_dev->file, global_openflags, 0);
if (fd < 0)
return fd;
err = read_cow_header(file_reader, &fd, &version, &backing_file, \
&mtime, &size, &sector_size, &align, &bitmap_offset);
os_close_file(fd);
if(err == -EINVAL)
file = ubd_dev->file;
else
file = backing_file;
out:
return os_file_size(file, size_out);
}

Näytä tiedosto

@@ -16,7 +16,6 @@
#include <sys/mman.h>
#include <sys/param.h>
#include "asm/types.h"
#include "user.h"
#include "ubd_user.h"
#include "os.h"
#include "cow.h"

Näytä tiedosto

@@ -0,0 +1,16 @@
/*
* Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
* Copyright (C) 2001 RidgeRun, Inc (glonnon@ridgerun.com)
* Licensed under the GPL
*/
#ifndef __UM_UBD_USER_H
#define __UM_UBD_USER_H
extern void ignore_sigwinch_sig(void);
extern int start_io_thread(unsigned long sp, int *fds_out);
extern int io_thread(void *arg);
extern int kernel_fd;
#endif

Näytä tiedosto

@@ -15,11 +15,9 @@
#include <unistd.h>
#include <errno.h>
#include <netinet/in.h>
#include "kern_constants.h"
#include "umcast.h"
#include "net_user.h"
#include "um_malloc.h"
#include "user.h"
static struct sockaddr_in *new_addr(char *addr, unsigned short port)
{

Näytä tiedosto

@@ -6,10 +6,8 @@
#include <stddef.h>
#include <errno.h>
#include <libvdeplug.h>
#include "kern_constants.h"
#include "net_user.h"
#include "um_malloc.h"
#include "user.h"
#include "vde.h"
static int vde_user_init(void *data, void *dev)

Näytä tiedosto

@@ -11,10 +11,8 @@
#include <string.h>
#include <termios.h>
#include "chan_user.h"
#include "kern_constants.h"
#include "os.h"
#include "um_malloc.h"
#include "user.h"
#include "xterm.h"
struct xterm_chan {