Commit 75e5584c authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

[PATCH] uml: use host AIO support

This patch makes UML use host AIO support when it (and
/usr/include/linux/aio_abi.h) are present.  This is only the support, with no
consumers - a consumer is coming in the next patch.
Signed-off-by: default avatarJeff Dike <jdike@addtoit.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 30f7dabb
/*
* Copyright (C) 2004 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
#ifndef AIO_H__
#define AIO_H__
enum aio_type { AIO_READ, AIO_WRITE, AIO_MMAP };
struct aio_thread_reply {
void *data;
int err;
};
struct aio_context {
int reply_fd;
struct aio_context *next;
};
#define INIT_AIO_CONTEXT { .reply_fd = -1, \
.next = NULL }
extern int submit_aio(enum aio_type type, int fd, char *buf, int len,
unsigned long long offset, int reply_fd,
struct aio_context *aio);
#endif
...@@ -111,7 +111,15 @@ extern struct uml_param __uml_setup_start, __uml_setup_end; ...@@ -111,7 +111,15 @@ extern struct uml_param __uml_setup_start, __uml_setup_end;
#ifndef __KERNEL__ #ifndef __KERNEL__
#define __initcall(fn) static initcall_t __initcall_##fn __init_call = fn #define __define_initcall(level,fn) \
static initcall_t __initcall_##fn __attribute_used__ \
__attribute__((__section__(".initcall" level ".init"))) = fn
/* Userspace initcalls shouldn't depend on anything in the kernel, so we'll
* make them run first.
*/
#define __initcall(fn) __define_initcall("1", fn)
#define __exitcall(fn) static exitcall_t __exitcall_##fn __exit_call = fn #define __exitcall(fn) static exitcall_t __exitcall_##fn __exit_call = fn
#define __init_call __attribute__ ((unused,__section__ (".initcall.init"))) #define __init_call __attribute__ ((unused,__section__ (".initcall.init")))
......
...@@ -7,12 +7,15 @@ ...@@ -7,12 +7,15 @@
#define __IRQ_KERN_H__ #define __IRQ_KERN_H__
#include "linux/interrupt.h" #include "linux/interrupt.h"
#include "asm/ptrace.h"
extern int um_request_irq(unsigned int irq, int fd, int type, extern int um_request_irq(unsigned int irq, int fd, int type,
irqreturn_t (*handler)(int, void *, irqreturn_t (*handler)(int, void *,
struct pt_regs *), struct pt_regs *),
unsigned long irqflags, const char * devname, unsigned long irqflags, const char * devname,
void *dev_id); void *dev_id);
extern int init_aio_irq(int irq, char *name,
irqreturn_t (*handler)(int, void *, struct pt_regs *));
#endif #endif
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include "kern_util.h" #include "kern_util.h"
#include "irq_user.h" #include "irq_user.h"
#include "irq_kern.h" #include "irq_kern.h"
#include "os.h"
/* /*
* Generic, controller-independent functions: * Generic, controller-independent functions:
...@@ -168,13 +168,32 @@ void __init init_IRQ(void) ...@@ -168,13 +168,32 @@ void __init init_IRQ(void)
} }
} }
/* int init_aio_irq(int irq, char *name, irqreturn_t (*handler)(int, void *,
* Overrides for Emacs so that we follow Linus's tabbing style. struct pt_regs *))
* Emacs will notice this stuff at the end of the file and automatically {
* adjust the settings for this buffer only. This must remain at the end int fds[2], err;
* of the file.
* --------------------------------------------------------------------------- err = os_pipe(fds, 1, 1);
* Local variables: if(err){
* c-file-style: "linux" printk("init_aio_irq - os_pipe failed, err = %d\n", -err);
* End: goto out;
*/ }
err = um_request_irq(irq, fds[0], IRQ_READ, handler,
SA_INTERRUPT | SA_SAMPLE_RANDOM, name,
(void *) (long) fds[0]);
if(err){
printk("init_aio_irq - : um_request_irq failed, err = %d\n",
err);
goto out_close;
}
err = fds[1];
goto out;
out_close:
os_close_file(fds[0]);
os_close_file(fds[1]);
out:
return(err);
}
...@@ -3,11 +3,15 @@ ...@@ -3,11 +3,15 @@
# Licensed under the GPL # Licensed under the GPL
# #
obj-y = elf_aux.o file.o process.o signal.o time.o tty.o user_syms.o drivers/ \ obj-y = aio.o elf_aux.o file.o process.o signal.o time.o tty.o user_syms.o \
sys-$(SUBARCH)/ drivers/ sys-$(SUBARCH)/
USER_OBJS := elf_aux.o file.o process.o signal.o time.o tty.o USER_OBJS := aio.o elf_aux.o file.o process.o signal.o time.o tty.o
CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH) CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH)
HAVE_AIO_ABI := $(shell [ -r /usr/include/linux/aio_abi.h ] && \
echo -DHAVE_AIO_ABI )
CFLAGS_aio.o += $(HAVE_AIO_ABI)
include arch/um/scripts/Makefile.rules include arch/um/scripts/Makefile.rules
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment