diff options
Diffstat (limited to 'tools/libaio/src')
-rw-r--r-- | tools/libaio/src/Makefile | 67 | ||||
-rw-r--r-- | tools/libaio/src/compat-0_1.c | 62 | ||||
-rw-r--r-- | tools/libaio/src/io_cancel.c | 23 | ||||
-rw-r--r-- | tools/libaio/src/io_destroy.c | 23 | ||||
-rw-r--r-- | tools/libaio/src/io_getevents.c | 57 | ||||
-rw-r--r-- | tools/libaio/src/io_queue_init.c | 33 | ||||
-rw-r--r-- | tools/libaio/src/io_queue_release.c | 27 | ||||
-rw-r--r-- | tools/libaio/src/io_queue_run.c | 39 | ||||
-rw-r--r-- | tools/libaio/src/io_queue_wait.c | 31 | ||||
-rw-r--r-- | tools/libaio/src/io_setup.c | 23 | ||||
-rw-r--r-- | tools/libaio/src/io_submit.c | 23 | ||||
-rw-r--r-- | tools/libaio/src/libaio.h | 222 | ||||
-rw-r--r-- | tools/libaio/src/libaio.map | 22 | ||||
-rw-r--r-- | tools/libaio/src/raw_syscall.c | 19 | ||||
-rw-r--r-- | tools/libaio/src/syscall-alpha.h | 209 | ||||
-rw-r--r-- | tools/libaio/src/syscall-i386.h | 72 | ||||
-rw-r--r-- | tools/libaio/src/syscall-ppc.h | 98 | ||||
-rw-r--r-- | tools/libaio/src/syscall-s390.h | 131 | ||||
-rw-r--r-- | tools/libaio/src/syscall-x86_64.h | 63 | ||||
-rw-r--r-- | tools/libaio/src/syscall.h | 27 | ||||
-rw-r--r-- | tools/libaio/src/vsys_def.h | 24 |
21 files changed, 0 insertions, 1295 deletions
diff --git a/tools/libaio/src/Makefile b/tools/libaio/src/Makefile deleted file mode 100644 index 575ad6130e..0000000000 --- a/tools/libaio/src/Makefile +++ /dev/null @@ -1,67 +0,0 @@ -XEN_ROOT = $(CURDIR)/../../.. -include $(XEN_ROOT)/tools/Rules.mk - -prefix=$(PREFIX) -includedir=$(prefix)/include -libdir=$(prefix)/lib - -ARCH := $(shell uname -m | sed -e s/i.86/i386/) -CFLAGS = -nostdlib -nostartfiles -Wall -I. -g -fomit-frame-pointer -O2 -fPIC -SO_CFLAGS=-shared $(CFLAGS) -L_CFLAGS=$(CFLAGS) -LINK_FLAGS= - -soname=libaio.so.1 -minor=0 -micro=1 -libname=$(soname).$(minor).$(micro) -all_targets += libaio.a $(libname) - -all: $(all_targets) - -# libaio provided functions -libaio_srcs := io_queue_init.c io_queue_release.c -libaio_srcs += io_queue_wait.c io_queue_run.c - -# real syscalls -libaio_srcs += io_getevents.c io_submit.c io_cancel.c -libaio_srcs += io_setup.c io_destroy.c - -# internal functions -libaio_srcs += raw_syscall.c - -# old symbols -libaio_srcs += compat-0_1.c - -libaio_objs := $(patsubst %.c,%.ol,$(libaio_srcs)) -libaio_sobjs := $(patsubst %.c,%.os,$(libaio_srcs)) - -$(libaio_objs) $(libaio_sobjs): libaio.h vsys_def.h - -%.os: %.c - $(CC) $(SO_CFLAGS) -c -o $@ $< - -%.ol: %.c - $(CC) $(L_CFLAGS) -c -o $@ $< - - -libaio.a: $(libaio_objs) - rm -f libaio.a - $(AR) r libaio.a $^ - $(RANLIB) libaio.a - -$(libname): $(libaio_sobjs) libaio.map - $(CC) $(SO_CFLAGS) -Wl,--version-script=libaio.map -Wl,-soname=$(soname) -o $@ $(libaio_sobjs) $(LINK_FLAGS) - -install: $(all_targets) - install -D -m 644 libaio.h $(DESTDIR)$(includedir)/libaio.h - install -D -m 644 libaio.a $(DESTDIR)$(libdir)/libaio.a - install -D -m 755 $(libname) $(DESTDIR)$(libdir)/$(libname) - ln -sf $(libname) $(DESTDIR)$(libdir)/$(soname) - ln -sf $(libname) $(DESTDIR)$(libdir)/libaio.so - -$(libaio_objs): libaio.h - -clean: - rm -f $(all_targets) $(libaio_objs) $(libaio_sobjs) $(soname).new - rm -f *.so* *.a *.o diff --git a/tools/libaio/src/compat-0_1.c b/tools/libaio/src/compat-0_1.c deleted file mode 100644 index 53d520b9f9..0000000000 --- a/tools/libaio/src/compat-0_1.c +++ /dev/null @@ -1,62 +0,0 @@ -/* libaio Linux async I/O interface - - compat-0_1.c : compatibility symbols for libaio 0.1.x-0.3.x - - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include <stdlib.h> -#include <sys/time.h> - -#include "libaio.h" -#include "vsys_def.h" - -#include "syscall.h" - - -/* ABI change. Provide partial compatibility on this one for now. */ -SYMVER(compat0_1_io_cancel, io_cancel, 0.1); -int compat0_1_io_cancel(io_context_t ctx, struct iocb *iocb) -{ - struct io_event event; - - /* FIXME: the old ABI would return the event on the completion queue */ - return io_cancel(ctx, iocb, &event); -} - -SYMVER(compat0_1_io_queue_wait, io_queue_wait, 0.1); -int compat0_1_io_queue_wait(io_context_t ctx, struct timespec *when) -{ - struct timespec timeout; - if (when) - timeout = *when; - return io_getevents(ctx, 0, 0, NULL, when ? &timeout : NULL); -} - - -/* ABI change. Provide backwards compatibility for this one. */ -SYMVER(compat0_1_io_getevents, io_getevents, 0.1); -int compat0_1_io_getevents(io_context_t ctx_id, long nr, - struct io_event *events, - const struct timespec *const_timeout) -{ - struct timespec timeout; - if (const_timeout) - timeout = *const_timeout; - return io_getevents(ctx_id, 1, nr, events, - const_timeout ? &timeout : NULL); -} - diff --git a/tools/libaio/src/io_cancel.c b/tools/libaio/src/io_cancel.c deleted file mode 100644 index 2f0f5f4aa0..0000000000 --- a/tools/libaio/src/io_cancel.c +++ /dev/null @@ -1,23 +0,0 @@ -/* io_cancel.c - libaio Linux async I/O interface - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include <libaio.h> -#include "syscall.h" - -io_syscall3(int, io_cancel_0_4, io_cancel, io_context_t, ctx, struct iocb *, iocb, struct io_event *, event) -DEFSYMVER(io_cancel_0_4, io_cancel, 0.4) diff --git a/tools/libaio/src/io_destroy.c b/tools/libaio/src/io_destroy.c deleted file mode 100644 index 0ab6bd1743..0000000000 --- a/tools/libaio/src/io_destroy.c +++ /dev/null @@ -1,23 +0,0 @@ -/* io_destroy - libaio Linux async I/O interface - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include <errno.h> -#include <libaio.h> -#include "syscall.h" - -io_syscall1(int, io_destroy, io_destroy, io_context_t, ctx) diff --git a/tools/libaio/src/io_getevents.c b/tools/libaio/src/io_getevents.c deleted file mode 100644 index 5a0517402d..0000000000 --- a/tools/libaio/src/io_getevents.c +++ /dev/null @@ -1,57 +0,0 @@ -/* io_getevents.c - libaio Linux async I/O interface - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include <libaio.h> -#include <errno.h> -#include <stdlib.h> -#include <time.h> -#include "syscall.h" - -io_syscall5(int, __io_getevents_0_4, io_getevents, io_context_t, ctx, long, min_nr, long, nr, struct io_event *, events, struct timespec *, timeout) - -#define AIO_RING_MAGIC 0xa10a10a1 - -/* Ben will hate me for this */ -struct aio_ring { - unsigned id; /* kernel internal index number */ - unsigned nr; /* number of io_events */ - unsigned head; - unsigned tail; - - unsigned magic; - unsigned compat_features; - unsigned incompat_features; - unsigned header_length; /* size of aio_ring */ -}; - -int io_getevents_0_4(io_context_t ctx, long min_nr, long nr, struct io_event * events, struct timespec * timeout) -{ - struct aio_ring *ring; - ring = (struct aio_ring*)ctx; - if (ring==NULL || ring->magic != AIO_RING_MAGIC) - goto do_syscall; - if (timeout!=NULL && timeout->tv_sec == 0 && timeout->tv_nsec == 0) { - if (ring->head == ring->tail) - return 0; - } - -do_syscall: - return __io_getevents_0_4(ctx, min_nr, nr, events, timeout); -} - -DEFSYMVER(io_getevents_0_4, io_getevents, 0.4) diff --git a/tools/libaio/src/io_queue_init.c b/tools/libaio/src/io_queue_init.c deleted file mode 100644 index 563d1375a4..0000000000 --- a/tools/libaio/src/io_queue_init.c +++ /dev/null @@ -1,33 +0,0 @@ -/* io_queue_init.c - libaio Linux async I/O interface - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include <libaio.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <errno.h> - -#include "syscall.h" - -int io_queue_init(int maxevents, io_context_t *ctxp) -{ - if (maxevents > 0) { - *ctxp = NULL; - return io_setup(maxevents, ctxp); - } - return -EINVAL; -} diff --git a/tools/libaio/src/io_queue_release.c b/tools/libaio/src/io_queue_release.c deleted file mode 100644 index 94bbb867a0..0000000000 --- a/tools/libaio/src/io_queue_release.c +++ /dev/null @@ -1,27 +0,0 @@ -/* io_queue_release.c - libaio Linux async I/O interface - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include <libaio.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <errno.h> - -int io_queue_release(io_context_t ctx) -{ - return io_destroy(ctx); -} diff --git a/tools/libaio/src/io_queue_run.c b/tools/libaio/src/io_queue_run.c deleted file mode 100644 index e0132f4009..0000000000 --- a/tools/libaio/src/io_queue_run.c +++ /dev/null @@ -1,39 +0,0 @@ -/* io_submit - libaio Linux async I/O interface - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include <libaio.h> -#include <errno.h> -#include <stdlib.h> -#include <time.h> - -int io_queue_run(io_context_t ctx) -{ - static struct timespec timeout = { 0, 0 }; - struct io_event event; - int ret; - - /* FIXME: batch requests? */ - while (1 == (ret = io_getevents(ctx, 0, 1, &event, &timeout))) { - io_callback_t cb = (io_callback_t)event.data; - struct iocb *iocb = event.obj; - - cb(ctx, iocb, event.res, event.res2); - } - - return ret; -} diff --git a/tools/libaio/src/io_queue_wait.c b/tools/libaio/src/io_queue_wait.c deleted file mode 100644 index 538d2f3b7b..0000000000 --- a/tools/libaio/src/io_queue_wait.c +++ /dev/null @@ -1,31 +0,0 @@ -/* io_submit - libaio Linux async I/O interface - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#define NO_SYSCALL_ERRNO -#include <sys/types.h> -#include <libaio.h> -#include <errno.h> -#include "syscall.h" - -struct timespec; - -int io_queue_wait_0_4(io_context_t ctx, struct timespec *timeout) -{ - return io_getevents(ctx, 0, 0, NULL, timeout); -} -DEFSYMVER(io_queue_wait_0_4, io_queue_wait, 0.4) diff --git a/tools/libaio/src/io_setup.c b/tools/libaio/src/io_setup.c deleted file mode 100644 index 4ba1afc993..0000000000 --- a/tools/libaio/src/io_setup.c +++ /dev/null @@ -1,23 +0,0 @@ -/* io_setup - libaio Linux async I/O interface - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include <errno.h> -#include <libaio.h> -#include "syscall.h" - -io_syscall2(int, io_setup, io_setup, int, maxevents, io_context_t *, ctxp) diff --git a/tools/libaio/src/io_submit.c b/tools/libaio/src/io_submit.c deleted file mode 100644 index e22ba54960..0000000000 --- a/tools/libaio/src/io_submit.c +++ /dev/null @@ -1,23 +0,0 @@ -/* io_submit - libaio Linux async I/O interface - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#include <errno.h> -#include <libaio.h> -#include "syscall.h" - -io_syscall3(int, io_submit, io_submit, io_context_t, ctx, long, nr, struct iocb **, iocbs) diff --git a/tools/libaio/src/libaio.h b/tools/libaio/src/libaio.h deleted file mode 100644 index 657460128a..0000000000 --- a/tools/libaio/src/libaio.h +++ /dev/null @@ -1,222 +0,0 @@ -/* /usr/include/libaio.h - * - * Copyright 2000,2001,2002 Red Hat, Inc. - * - * Written by Benjamin LaHaise <bcrl@redhat.com> - * - * libaio Linux async I/O interface - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -#ifndef __LIBAIO_H -#define __LIBAIO_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <sys/types.h> -#include <string.h> - -struct timespec; -struct sockaddr; -struct iovec; -struct iocb; - -typedef struct io_context *io_context_t; - -typedef enum io_iocb_cmd { - IO_CMD_PREAD = 0, - IO_CMD_PWRITE = 1, - - IO_CMD_FSYNC = 2, - IO_CMD_FDSYNC = 3, - - IO_CMD_POLL = 5, - IO_CMD_NOOP = 6, -} io_iocb_cmd_t; - -#if defined(__i386__) /* little endian, 32 bits */ -#define PADDED(x, y) x; unsigned y -#define PADDEDptr(x, y) x; unsigned y -#define PADDEDul(x, y) unsigned long x; unsigned y -#elif defined(__ia64__) || defined(__x86_64__) || defined(__alpha__) -#define PADDED(x, y) x, y -#define PADDEDptr(x, y) x -#define PADDEDul(x, y) unsigned long x -#elif defined(__powerpc64__) /* big endian, 64 bits */ -#define PADDED(x, y) unsigned y; x -#define PADDEDptr(x,y) x -#define PADDEDul(x, y) unsigned long x -#elif defined(__PPC__) /* big endian, 32 bits */ -#define PADDED(x, y) unsigned y; x -#define PADDEDptr(x, y) unsigned y; x -#define PADDEDul(x, y) unsigned y; unsigned long x -#elif defined(__s390x__) /* big endian, 64 bits */ -#define PADDED(x, y) unsigned y; x -#define PADDEDptr(x,y) x -#define PADDEDul(x, y) unsigned long x -#elif defined(__s390__) /* big endian, 32 bits */ -#define PADDED(x, y) unsigned y; x -#define PADDEDptr(x, y) unsigned y; x -#define PADDEDul(x, y) unsigned y; unsigned long x -#else -#error endian? -#endif - -struct io_iocb_poll { - PADDED(int events, __pad1); -}; /* result code is the set of result flags or -'ve errno */ - -struct io_iocb_sockaddr { - struct sockaddr *addr; - int len; -}; /* result code is the length of the sockaddr, or -'ve errno */ - -struct io_iocb_common { - PADDEDptr(void *buf, __pad1); - PADDEDul(nbytes, __pad2); - long long offset; - long long __pad3, __pad4; -}; /* result code is the amount read or -'ve errno */ - -struct io_iocb_vector { - const struct iovec *vec; - int nr; - long long offset; -}; /* result code is the amount read or -'ve errno */ - -struct iocb { - PADDEDptr(void *data, __pad1); /* Return in the io completion event */ - PADDED(unsigned key, __pad2); /* For use in identifying io requests */ - - short aio_lio_opcode; - short aio_reqprio; - int aio_fildes; - - union { - struct io_iocb_common c; - struct io_iocb_vector v; - struct io_iocb_poll poll; - struct io_iocb_sockaddr saddr; - } u; -}; - -struct io_event { - PADDEDptr(void *data, __pad1); - PADDEDptr(struct iocb *obj, __pad2); - PADDEDul(res, __pad3); - PADDEDul(res2, __pad4); -}; - -#undef PADDED -#undef PADDEDptr -#undef PADDEDul - -typedef void (*io_callback_t)(io_context_t ctx, struct iocb *iocb, long res, long res2); - -/* library wrappers */ -extern int io_queue_init(int maxevents, io_context_t *ctxp); -/*extern int io_queue_grow(io_context_t ctx, int new_maxevents);*/ -extern int io_queue_release(io_context_t ctx); -/*extern int io_queue_wait(io_context_t ctx, struct timespec *timeout);*/ -extern int io_queue_run(io_context_t ctx); - -/* Actual syscalls */ -extern int io_setup(int maxevents, io_context_t *ctxp); -extern int io_destroy(io_context_t ctx); -extern int io_submit(io_context_t ctx, long nr, struct iocb *ios[]); -extern int io_cancel(io_context_t ctx, struct iocb *iocb, struct io_event *evt); -extern int io_getevents(io_context_t ctx_id, long min_nr, long nr, struct io_event *events, struct timespec *timeout); - - -static inline void io_set_callback(struct iocb *iocb, io_callback_t cb) -{ - iocb->data = (void *)cb; -} - -static inline void io_prep_pread(struct iocb *iocb, int fd, void *buf, size_t count, long long offset) -{ - memset(iocb, 0, sizeof(*iocb)); - iocb->aio_fildes = fd; - iocb->aio_lio_opcode = IO_CMD_PREAD; - iocb->aio_reqprio = 0; - iocb->u.c.buf = buf; - iocb->u.c.nbytes = count; - iocb->u.c.offset = offset; -} - -static inline void io_prep_pwrite(struct iocb *iocb, int fd, void *buf, size_t count, long long offset) -{ - memset(iocb, 0, sizeof(*iocb)); - iocb->aio_fildes = fd; - iocb->aio_lio_opcode = IO_CMD_PWRITE; - iocb->aio_reqprio = 0; - iocb->u.c.buf = buf; - iocb->u.c.nbytes = count; - iocb->u.c.offset = offset; -} - -static inline void io_prep_poll(struct iocb *iocb, int fd, int events) -{ - memset(iocb, 0, sizeof(*iocb)); - iocb->aio_fildes = fd; - iocb->aio_lio_opcode = IO_CMD_POLL; - iocb->aio_reqprio = 0; - iocb->u.poll.events = events; -} - -static inline int io_poll(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd, int events) -{ - io_prep_poll(iocb, fd, events); - io_set_callback(iocb, cb); - return io_submit(ctx, 1, &iocb); -} - -static inline void io_prep_fsync(struct iocb *iocb, int fd) -{ - memset(iocb, 0, sizeof(*iocb)); - iocb->aio_fildes = fd; - iocb->aio_lio_opcode = IO_CMD_FSYNC; - iocb->aio_reqprio = 0; -} - -static inline int io_fsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd) -{ - io_prep_fsync(iocb, fd); - io_set_callback(iocb, cb); - return io_submit(ctx, 1, &iocb); -} - -static inline void io_prep_fdsync(struct iocb *iocb, int fd) -{ - memset(iocb, 0, sizeof(*iocb)); - iocb->aio_fildes = fd; - iocb->aio_lio_opcode = IO_CMD_FDSYNC; - iocb->aio_reqprio = 0; -} - -static inline int io_fdsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd) -{ - io_prep_fdsync(iocb, fd); - io_set_callback(iocb, cb); - return io_submit(ctx, 1, &iocb); -} - -#ifdef __cplusplus -} -#endif - -#endif /* __LIBAIO_H */ diff --git a/tools/libaio/src/libaio.map b/tools/libaio/src/libaio.map deleted file mode 100644 index dc37725960..0000000000 --- a/tools/libaio/src/libaio.map +++ /dev/null @@ -1,22 +0,0 @@ -LIBAIO_0.1 { - global: - io_queue_init; - io_queue_run; - io_queue_wait; - io_queue_release; - io_cancel; - io_submit; - io_getevents; - local: - *; - -}; - -LIBAIO_0.4 { - global: - io_setup; - io_destroy; - io_cancel; - io_getevents; - io_queue_wait; -} LIBAIO_0.1; diff --git a/tools/libaio/src/raw_syscall.c b/tools/libaio/src/raw_syscall.c deleted file mode 100644 index c3fe4b8deb..0000000000 --- a/tools/libaio/src/raw_syscall.c +++ /dev/null @@ -1,19 +0,0 @@ -#include "syscall.h" - -#if defined(__ia64__) -/* based on code from glibc by Jes Sorensen */ -__asm__(".text\n" - ".globl __ia64_aio_raw_syscall\n" - ".proc __ia64_aio_raw_syscall\n" - "__ia64_aio_raw_syscall:\n" - "alloc r2=ar.pfs,1,0,8,0\n" - "mov r15=r32\n" - "break 0x100000\n" - ";;" - "br.ret.sptk.few b0\n" - ".size __ia64_aio_raw_syscall, . - __ia64_aio_raw_syscall\n" - ".endp __ia64_aio_raw_syscall" -); -#endif - -; diff --git a/tools/libaio/src/syscall-alpha.h b/tools/libaio/src/syscall-alpha.h deleted file mode 100644 index 467b74f07e..0000000000 --- a/tools/libaio/src/syscall-alpha.h +++ /dev/null @@ -1,209 +0,0 @@ -#define __NR_io_setup 398 -#define __NR_io_destroy 399 -#define __NR_io_getevents 400 -#define __NR_io_submit 401 -#define __NR_io_cancel 402 - -#define inline_syscall_r0_asm -#define inline_syscall_r0_out_constraint "=v" - -#define inline_syscall_clobbers \ - "$1", "$2", "$3", "$4", "$5", "$6", "$7", "$8", \ - "$22", "$23", "$24", "$25", "$27", "$28", "memory" - -#define inline_syscall0(name, args...) \ -{ \ - register long _sc_0 inline_syscall_r0_asm; \ - register long _sc_19 __asm__("$19"); \ - \ - _sc_0 = name; \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2" \ - : inline_syscall_r0_out_constraint (_sc_0), \ - "=r"(_sc_19) \ - : "0"(_sc_0) \ - : inline_syscall_clobbers, \ - "$16", "$17", "$18", "$20", "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall1(name,arg1) \ -{ \ - register long _sc_0 inline_syscall_r0_asm; \ - register long _sc_16 __asm__("$16"); \ - register long _sc_19 __asm__("$19"); \ - \ - _sc_0 = name; \ - _sc_16 = (long) (arg1); \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3" \ - : inline_syscall_r0_out_constraint (_sc_0), \ - "=r"(_sc_19), "=r"(_sc_16) \ - : "0"(_sc_0), "2"(_sc_16) \ - : inline_syscall_clobbers, \ - "$17", "$18", "$20", "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall2(name,arg1,arg2) \ -{ \ - register long _sc_0 inline_syscall_r0_asm; \ - register long _sc_16 __asm__("$16"); \ - register long _sc_17 __asm__("$17"); \ - register long _sc_19 __asm__("$19"); \ - \ - _sc_0 = name; \ - _sc_16 = (long) (arg1); \ - _sc_17 = (long) (arg2); \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3 %4" \ - : inline_syscall_r0_out_constraint (_sc_0), \ - "=r"(_sc_19), "=r"(_sc_16), "=r"(_sc_17) \ - : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17) \ - : inline_syscall_clobbers, \ - "$18", "$20", "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall3(name,arg1,arg2,arg3) \ -{ \ - register long _sc_0 inline_syscall_r0_asm; \ - register long _sc_16 __asm__("$16"); \ - register long _sc_17 __asm__("$17"); \ - register long _sc_18 __asm__("$18"); \ - register long _sc_19 __asm__("$19"); \ - \ - _sc_0 = name; \ - _sc_16 = (long) (arg1); \ - _sc_17 = (long) (arg2); \ - _sc_18 = (long) (arg3); \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3 %4 %5" \ - : inline_syscall_r0_out_constraint (_sc_0), \ - "=r"(_sc_19), "=r"(_sc_16), "=r"(_sc_17), \ - "=r"(_sc_18) \ - : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17), \ - "4"(_sc_18) \ - : inline_syscall_clobbers, "$20", "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall4(name,arg1,arg2,arg3,arg4) \ -{ \ - register long _sc_0 inline_syscall_r0_asm; \ - register long _sc_16 __asm__("$16"); \ - register long _sc_17 __asm__("$17"); \ - register long _sc_18 __asm__("$18"); \ - register long _sc_19 __asm__("$19"); \ - \ - _sc_0 = name; \ - _sc_16 = (long) (arg1); \ - _sc_17 = (long) (arg2); \ - _sc_18 = (long) (arg3); \ - _sc_19 = (long) (arg4); \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3 %4 %5 %6" \ - : inline_syscall_r0_out_constraint (_sc_0), \ - "=r"(_sc_19), "=r"(_sc_16), "=r"(_sc_17), \ - "=r"(_sc_18) \ - : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17), \ - "4"(_sc_18), "1"(_sc_19) \ - : inline_syscall_clobbers, "$20", "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall5(name,arg1,arg2,arg3,arg4,arg5) \ -{ \ - register long _sc_0 inline_syscall_r0_asm; \ - register long _sc_16 __asm__("$16"); \ - register long _sc_17 __asm__("$17"); \ - register long _sc_18 __asm__("$18"); \ - register long _sc_19 __asm__("$19"); \ - register long _sc_20 __asm__("$20"); \ - \ - _sc_0 = name; \ - _sc_16 = (long) (arg1); \ - _sc_17 = (long) (arg2); \ - _sc_18 = (long) (arg3); \ - _sc_19 = (long) (arg4); \ - _sc_20 = (long) (arg5); \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7" \ - : inline_syscall_r0_out_constraint (_sc_0), \ - "=r"(_sc_19), "=r"(_sc_16), "=r"(_sc_17), \ - "=r"(_sc_18), "=r"(_sc_20) \ - : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17), \ - "4"(_sc_18), "1"(_sc_19), "5"(_sc_20) \ - : inline_syscall_clobbers, "$21"); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define inline_syscall6(name,arg1,arg2,arg3,arg4,arg5,arg6) \ -{ \ - register long _sc_0 inline_syscall_r0_asm; \ - register long _sc_16 __asm__("$16"); \ - register long _sc_17 __asm__("$17"); \ - register long _sc_18 __asm__("$18"); \ - register long _sc_19 __asm__("$19"); \ - register long _sc_20 __asm__("$20"); \ - register long _sc_21 __asm__("$21"); \ - \ - _sc_0 = name; \ - _sc_16 = (long) (arg1); \ - _sc_17 = (long) (arg2); \ - _sc_18 = (long) (arg3); \ - _sc_19 = (long) (arg4); \ - _sc_20 = (long) (arg5); \ - _sc_21 = (long) (arg6); \ - __asm__ __volatile__ \ - ("callsys # %0 %1 <= %2 %3 %4 %5 %6 %7 %8" \ - : inline_syscall_r0_out_constraint (_sc_0), \ - "=r"(_sc_19), "=r"(_sc_16), "=r"(_sc_17), \ - "=r"(_sc_18), "=r"(_sc_20), "=r"(_sc_21) \ - : "0"(_sc_0), "2"(_sc_16), "3"(_sc_17), "4"(_sc_18), \ - "1"(_sc_19), "5"(_sc_20), "6"(_sc_21) \ - : inline_syscall_clobbers); \ - _sc_ret = _sc_0, _sc_err = _sc_19; \ -} - -#define INLINE_SYSCALL1(name, nr, args...) \ -({ \ - long _sc_ret, _sc_err; \ - inline_syscall##nr(__NR_##name, args); \ - if (_sc_err != 0) \ - { \ - _sc_ret = -(_sc_ret); \ - } \ - _sc_ret; \ -}) - -#define io_syscall1(type,fname,sname,type1,arg1) \ -type fname(type1 arg1) \ -{ \ - return (type)INLINE_SYSCALL1(sname, 1, arg1); \ -} - -#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ -type fname(type1 arg1,type2 arg2) \ -{ \ - return (type)INLINE_SYSCALL1(sname, 2, arg1, arg2); \ -} - -#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \ -type fname(type1 arg1,type2 arg2,type3 arg3) \ -{ \ - return (type)INLINE_SYSCALL1(sname, 3, arg1, arg2, arg3); \ -} - -#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ -{ \ - return (type)INLINE_SYSCALL1(sname, 4, arg1, arg2, arg3, arg4); \ -} - -#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5) \ -type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ -{ \ - return (type)INLINE_SYSCALL1(sname, 5, arg1, arg2, arg3, arg4, arg5);\ -} diff --git a/tools/libaio/src/syscall-i386.h b/tools/libaio/src/syscall-i386.h deleted file mode 100644 index 9576975a19..0000000000 --- a/tools/libaio/src/syscall-i386.h +++ /dev/null @@ -1,72 +0,0 @@ -#define __NR_io_setup 245 -#define __NR_io_destroy 246 -#define __NR_io_getevents 247 -#define __NR_io_submit 248 -#define __NR_io_cancel 249 - -#define io_syscall1(type,fname,sname,type1,arg1) \ -type fname(type1 arg1) \ -{ \ -long __res; \ -__asm__ volatile ("xchgl %%edi,%%ebx\n" \ - "int $0x80\n" \ - "xchgl %%edi,%%ebx" \ - : "=a" (__res) \ - : "0" (__NR_##sname),"D" ((long)(arg1))); \ -return __res; \ -} - -#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ -type fname(type1 arg1,type2 arg2) \ -{ \ -long __res; \ -__asm__ volatile ("xchgl %%edi,%%ebx\n" \ - "int $0x80\n" \ - "xchgl %%edi,%%ebx" \ - : "=a" (__res) \ - : "0" (__NR_##sname),"D" ((long)(arg1)),"c" ((long)(arg2))); \ -return __res; \ -} - -#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \ -type fname(type1 arg1,type2 arg2,type3 arg3) \ -{ \ -long __res; \ -__asm__ volatile ("xchgl %%edi,%%ebx\n" \ - "int $0x80\n" \ - "xchgl %%edi,%%ebx" \ - : "=a" (__res) \ - : "0" (__NR_##sname),"D" ((long)(arg1)),"c" ((long)(arg2)), \ - "d" ((long)(arg3))); \ -return __res; \ -} - -#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ -{ \ -long __res; \ -__asm__ volatile ("xchgl %%edi,%%ebx\n" \ - "int $0x80\n" \ - "xchgl %%edi,%%ebx" \ - : "=a" (__res) \ - : "0" (__NR_##sname),"D" ((long)(arg1)),"c" ((long)(arg2)), \ - "d" ((long)(arg3)),"S" ((long)(arg4))); \ -return __res; \ -} - -#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5) \ -type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ -{ \ -long __res; \ -long tmp; \ -__asm__ volatile ("movl %%ebx,%7\n" \ - "movl %2,%%ebx\n" \ - "int $0x80\n" \ - "movl %7,%%ebx" \ - : "=a" (__res) \ - : "0" (__NR_##sname),"rm" ((long)(arg1)),"c" ((long)(arg2)), \ - "d" ((long)(arg3)),"S" ((long)(arg4)),"D" ((long)(arg5)), \ - "m" (tmp)); \ -return __res; \ -} diff --git a/tools/libaio/src/syscall-ppc.h b/tools/libaio/src/syscall-ppc.h deleted file mode 100644 index 435513e799..0000000000 --- a/tools/libaio/src/syscall-ppc.h +++ /dev/null @@ -1,98 +0,0 @@ -#include <asm/unistd.h> -#include <errno.h> - -#define __NR_io_setup 227 -#define __NR_io_destroy 228 -#define __NR_io_getevents 229 -#define __NR_io_submit 230 -#define __NR_io_cancel 231 - -/* On powerpc a system call basically clobbers the same registers like a - * function call, with the exception of LR (which is needed for the - * "sc; bnslr" sequence) and CR (where only CR0.SO is clobbered to signal - * an error return status). - */ -#ifndef __syscall_nr -#define __syscall_nr(nr, type, name, args...) \ - unsigned long __sc_ret, __sc_err; \ - { \ - register unsigned long __sc_0 __asm__ ("r0"); \ - register unsigned long __sc_3 __asm__ ("r3"); \ - register unsigned long __sc_4 __asm__ ("r4"); \ - register unsigned long __sc_5 __asm__ ("r5"); \ - register unsigned long __sc_6 __asm__ ("r6"); \ - register unsigned long __sc_7 __asm__ ("r7"); \ - register unsigned long __sc_8 __asm__ ("r8"); \ - \ - __sc_loadargs_##nr(name, args); \ - __asm__ __volatile__ \ - ("sc \n\t" \ - "mfcr %0 " \ - : "=&r" (__sc_0), \ - "=&r" (__sc_3), "=&r" (__sc_4), \ - "=&r" (__sc_5), "=&r" (__sc_6), \ - "=&r" (__sc_7), "=&r" (__sc_8) \ - : __sc_asm_input_##nr \ - : "cr0", "ctr", "memory", \ - "r9", "r10","r11", "r12"); \ - __sc_ret = __sc_3; \ - __sc_err = __sc_0; \ - } \ - if (__sc_err & 0x10000000) return -((int)__sc_ret); \ - return (type) __sc_ret -#endif - -#define __sc_loadargs_0(name, dummy...) \ - __sc_0 = __NR_##name -#define __sc_loadargs_1(name, arg1) \ - __sc_loadargs_0(name); \ - __sc_3 = (unsigned long) (arg1) -#define __sc_loadargs_2(name, arg1, arg2) \ - __sc_loadargs_1(name, arg1); \ - __sc_4 = (unsigned long) (arg2) -#define __sc_loadargs_3(name, arg1, arg2, arg3) \ - __sc_loadargs_2(name, arg1, arg2); \ - __sc_5 = (unsigned long) (arg3) -#define __sc_loadargs_4(name, arg1, arg2, arg3, arg4) \ - __sc_loadargs_3(name, arg1, arg2, arg3); \ - __sc_6 = (unsigned long) (arg4) -#define __sc_loadargs_5(name, arg1, arg2, arg3, arg4, arg5) \ - __sc_loadargs_4(name, arg1, arg2, arg3, arg4); \ - __sc_7 = (unsigned long) (arg5) - -#define __sc_asm_input_0 "0" (__sc_0) -#define __sc_asm_input_1 __sc_asm_input_0, "1" (__sc_3) -#define __sc_asm_input_2 __sc_asm_input_1, "2" (__sc_4) -#define __sc_asm_input_3 __sc_asm_input_2, "3" (__sc_5) -#define __sc_asm_input_4 __sc_asm_input_3, "4" (__sc_6) -#define __sc_asm_input_5 __sc_asm_input_4, "5" (__sc_7) - -#define io_syscall1(type,fname,sname,type1,arg1) \ -type fname(type1 arg1) \ -{ \ - __syscall_nr(1, type, sname, arg1); \ -} - -#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ -type fname(type1 arg1, type2 arg2) \ -{ \ - __syscall_nr(2, type, sname, arg1, arg2); \ -} - -#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \ -type fname(type1 arg1, type2 arg2, type3 arg3) \ -{ \ - __syscall_nr(3, type, sname, arg1, arg2, arg3); \ -} - -#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ -{ \ - __syscall_nr(4, type, sname, arg1, arg2, arg3, arg4); \ -} - -#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4,type5,arg5) \ -type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4, type5 arg5) \ -{ \ - __syscall_nr(5, type, sname, arg1, arg2, arg3, arg4, arg5); \ -} diff --git a/tools/libaio/src/syscall-s390.h b/tools/libaio/src/syscall-s390.h deleted file mode 100644 index 3ec5ee34ee..0000000000 --- a/tools/libaio/src/syscall-s390.h +++ /dev/null @@ -1,131 +0,0 @@ -#define __NR_io_setup 243 -#define __NR_io_destroy 244 -#define __NR_io_getevents 245 -#define __NR_io_submit 246 -#define __NR_io_cancel 247 - -#define io_svc_clobber "1", "cc", "memory" - -#define io_syscall1(type,fname,sname,type1,arg1) \ -type fname(type1 arg1) { \ - register type1 __arg1 asm("2") = arg1; \ - register long __svcres asm("2"); \ - long __res; \ - __asm__ __volatile__ ( \ - " .if %1 < 256\n" \ - " svc %b1\n" \ - " .else\n" \ - " la %%r1,%1\n" \ - " .svc 0\n" \ - " .endif" \ - : "=d" (__svcres) \ - : "i" (__NR_##sname), \ - "0" (__arg1) \ - : io_svc_clobber ); \ - __res = __svcres; \ - return (type) __res; \ -} - -#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ -type fname(type1 arg1, type2 arg2) { \ - register type1 __arg1 asm("2") = arg1; \ - register type2 __arg2 asm("3") = arg2; \ - register long __svcres asm("2"); \ - long __res; \ - __asm__ __volatile__ ( \ - " .if %1 < 256\n" \ - " svc %b1\n" \ - " .else\n" \ - " la %%r1,%1\n" \ - " svc 0\n" \ - " .endif" \ - : "=d" (__svcres) \ - : "i" (__NR_##sname), \ - "0" (__arg1), \ - "d" (__arg2) \ - : io_svc_clobber ); \ - __res = __svcres; \ - return (type) __res; \ -} - -#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2, \ - type3,arg3) \ -type fname(type1 arg1, type2 arg2, type3 arg3) { \ - register type1 __arg1 asm("2") = arg1; \ - register type2 __arg2 asm("3") = arg2; \ - register type3 __arg3 asm("4") = arg3; \ - register long __svcres asm("2"); \ - long __res; \ - __asm__ __volatile__ ( \ - " .if %1 < 256\n" \ - " svc %b1\n" \ - " .else\n" \ - " la %%r1,%1\n" \ - " svc 0\n" \ - " .endif" \ - : "=d" (__svcres) \ - : "i" (__NR_##sname), \ - "0" (__arg1), \ - "d" (__arg2), \ - "d" (__arg3) \ - : io_svc_clobber ); \ - __res = __svcres; \ - return (type) __res; \ -} - -#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2, \ - type3,arg3,type4,arg4) \ -type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ - register type1 __arg1 asm("2") = arg1; \ - register type2 __arg2 asm("3") = arg2; \ - register type3 __arg3 asm("4") = arg3; \ - register type4 __arg4 asm("5") = arg4; \ - register long __svcres asm("2"); \ - long __res; \ - __asm__ __volatile__ ( \ - " .if %1 < 256\n" \ - " svc %b1\n" \ - " .else\n" \ - " la %%r1,%1\n" \ - " svc 0\n" \ - " .endif" \ - : "=d" (__svcres) \ - : "i" (__NR_##sname), \ - "0" (__arg1), \ - "d" (__arg2), \ - "d" (__arg3), \ - "d" (__arg4) \ - : io_svc_clobber ); \ - __res = __svcres; \ - return (type) __res; \ -} - -#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2, \ - type3,arg3,type4,arg4,type5,arg5) \ -type fname(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ - type5 arg5) { \ - register type1 __arg1 asm("2") = arg1; \ - register type2 __arg2 asm("3") = arg2; \ - register type3 __arg3 asm("4") = arg3; \ - register type4 __arg4 asm("5") = arg4; \ - register type5 __arg5 asm("6") = arg5; \ - register long __svcres asm("2"); \ - long __res; \ - __asm__ __volatile__ ( \ - " .if %1 < 256\n" \ - " svc %b1\n" \ - " .else\n" \ - " la %%r1,%1\n" \ - " svc 0\n" \ - " .endif" \ - : "=d" (__svcres) \ - : "i" (__NR_##sname), \ - "0" (__arg1), \ - "d" (__arg2), \ - "d" (__arg3), \ - "d" (__arg4), \ - "d" (__arg5) \ - : io_svc_clobber ); \ - __res = __svcres; \ - return (type) __res; \ -} diff --git a/tools/libaio/src/syscall-x86_64.h b/tools/libaio/src/syscall-x86_64.h deleted file mode 100644 index 9361856723..0000000000 --- a/tools/libaio/src/syscall-x86_64.h +++ /dev/null @@ -1,63 +0,0 @@ -#define __NR_io_setup 206 -#define __NR_io_destroy 207 -#define __NR_io_getevents 208 -#define __NR_io_submit 209 -#define __NR_io_cancel 210 - -#define __syscall_clobber "r11","rcx","memory" -#define __syscall "syscall" - -#define io_syscall1(type,fname,sname,type1,arg1) \ -type fname(type1 arg1) \ -{ \ -long __res; \ -__asm__ volatile (__syscall \ - : "=a" (__res) \ - : "0" (__NR_##sname),"D" ((long)(arg1)) : __syscall_clobber ); \ -return __res; \ -} - -#define io_syscall2(type,fname,sname,type1,arg1,type2,arg2) \ -type fname(type1 arg1,type2 arg2) \ -{ \ -long __res; \ -__asm__ volatile (__syscall \ - : "=a" (__res) \ - : "0" (__NR_##sname),"D" ((long)(arg1)),"S" ((long)(arg2)) : __syscall_clobber ); \ -return __res; \ -} - -#define io_syscall3(type,fname,sname,type1,arg1,type2,arg2,type3,arg3) \ -type fname(type1 arg1,type2 arg2,type3 arg3) \ -{ \ -long __res; \ -__asm__ volatile (__syscall \ - : "=a" (__res) \ - : "0" (__NR_##sname),"D" ((long)(arg1)),"S" ((long)(arg2)), \ - "d" ((long)(arg3)) : __syscall_clobber); \ -return __res; \ -} - -#define io_syscall4(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ -type fname (type1 arg1, type2 arg2, type3 arg3, type4 arg4) \ -{ \ -long __res; \ -__asm__ volatile ("movq %5,%%r10 ;" __syscall \ - : "=a" (__res) \ - : "0" (__NR_##sname),"D" ((long)(arg1)),"S" ((long)(arg2)), \ - "d" ((long)(arg3)),"g" ((long)(arg4)) : __syscall_clobber,"r10" ); \ -return __res; \ -} - -#define io_syscall5(type,fname,sname,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ - type5,arg5) \ -type fname (type1 arg1,type2 arg2,type3 arg3,type4 arg4,type5 arg5) \ -{ \ -long __res; \ -__asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; " __syscall \ - : "=a" (__res) \ - : "0" (__NR_##sname),"D" ((long)(arg1)),"S" ((long)(arg2)), \ - "d" ((long)(arg3)),"g" ((long)(arg4)),"g" ((long)(arg5)) : \ - __syscall_clobber,"r8","r10" ); \ -return __res; \ -} diff --git a/tools/libaio/src/syscall.h b/tools/libaio/src/syscall.h deleted file mode 100644 index 0283825817..0000000000 --- a/tools/libaio/src/syscall.h +++ /dev/null @@ -1,27 +0,0 @@ -#include <sys/syscall.h> -#include <unistd.h> - -#define _SYMSTR(str) #str -#define SYMSTR(str) _SYMSTR(str) - -#define SYMVER(compat_sym, orig_sym, ver_sym) \ - __asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@LIBAIO_" SYMSTR(ver_sym)); - -#define DEFSYMVER(compat_sym, orig_sym, ver_sym) \ - __asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@@LIBAIO_" SYMSTR(ver_sym)); - -#if defined(__i386__) -#include "syscall-i386.h" -#elif defined(__x86_64__) -#include "syscall-x86_64.h" -#elif defined(__ia64__) -#include "syscall-ia64.h" -#elif defined(__PPC__) -#include "syscall-ppc.h" -#elif defined(__s390__) -#include "syscall-s390.h" -#elif defined(__alpha__) -#include "syscall-alpha.h" -#else -#error "add syscall-arch.h" -#endif diff --git a/tools/libaio/src/vsys_def.h b/tools/libaio/src/vsys_def.h deleted file mode 100644 index 13d032e330..0000000000 --- a/tools/libaio/src/vsys_def.h +++ /dev/null @@ -1,24 +0,0 @@ -/* libaio Linux async I/O interface - Copyright 2002 Red Hat, Inc. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -extern int vsys_io_setup(unsigned nr_reqs, io_context_t *ctxp); -extern int vsys_io_destroy(io_context_t ctx); -extern int vsys_io_submit(io_context_t ctx, long nr, struct iocb *iocbs[]); -extern int vsys_io_cancel(io_context_t ctx, struct iocb *iocb); -extern int vsys_io_wait(io_context_t ctx, struct iocb *iocb, const struct timespec *when); -extern int vsys_io_getevents(io_context_t ctx_id, long nr, struct io_event *events, const struct timespec *timeout); - |