ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libeio/eio.c
(Generate patch)

Comparing libeio/eio.c (file contents):
Revision 1.106 by root, Mon Sep 26 20:19:08 2011 UTC vs.
Revision 1.117 by root, Sun Apr 1 17:22:42 2012 UTC

1/* 1/*
2 * libeio implementation 2 * libeio implementation
3 * 3 *
4 * Copyright (c) 2007,2008,2009,2010,2011 Marc Alexander Lehmann <libeio@schmorp.de> 4 * Copyright (c) 2007,2008,2009,2010,2011,2012 Marc Alexander Lehmann <libeio@schmorp.de>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without modifica- 7 * Redistribution and use in source and binary forms, with or without modifica-
8 * tion, are permitted provided that the following conditions are met: 8 * tion, are permitted provided that the following conditions are met:
9 * 9 *
58#include <sys/stat.h> 58#include <sys/stat.h>
59#include <limits.h> 59#include <limits.h>
60#include <fcntl.h> 60#include <fcntl.h>
61#include <assert.h> 61#include <assert.h>
62 62
63#if _POSIX_VERSION >= 200809L
64# define HAVE_AT 1
65#else
66# define HAVE_AT 0
67#endif
68
69/* intptr_t comes from unistd.h, says POSIX/UNIX/tradition */ 63/* intptr_t comes from unistd.h, says POSIX/UNIX/tradition */
70/* intptr_t only comes from stdint.h, says idiot openbsd coder */ 64/* intptr_t only comes from stdint.h, says idiot openbsd coder */
71#if HAVE_STDINT_H 65#if HAVE_STDINT_H
72# include <stdint.h> 66# include <stdint.h>
73#endif 67#endif
318 } 312 }
319 313
320 return buf->ptr; 314 return buf->ptr;
321} 315}
322 316
317struct tmpbuf;
318
319#if _POSIX_VERSION >= 200809L
320 #define HAVE_AT 1
321 #define WD2FD(wd) ((wd) ? (wd)->fd : AT_FDCWD)
322 #ifndef O_SEARCH
323 #define O_SEARCH O_RDONLY
324 #endif
325#else
326 #define HAVE_AT 0
327 static const char *wd_expand (struct tmpbuf *tmpbuf, eio_wd wd, const char *path);
328#endif
329
330struct eio_pwd
331{
332#if HAVE_AT
333 int fd;
334#endif
335 int len;
336 char str[1]; /* actually, a 0-terminated canonical path */
337};
338
323/*****************************************************************************/ 339/*****************************************************************************/
324 340
325#define ETP_PRI_MIN EIO_PRI_MIN 341#define ETP_PRI_MIN EIO_PRI_MIN
326#define ETP_PRI_MAX EIO_PRI_MAX 342#define ETP_PRI_MAX EIO_PRI_MAX
327 343
393#define ETP_WORKER_LOCK(wrk) X_LOCK (wrklock) 409#define ETP_WORKER_LOCK(wrk) X_LOCK (wrklock)
394#define ETP_WORKER_UNLOCK(wrk) X_UNLOCK (wrklock) 410#define ETP_WORKER_UNLOCK(wrk) X_UNLOCK (wrklock)
395 411
396/* worker threads management */ 412/* worker threads management */
397 413
398static void ecb_cold 414static void
399etp_worker_clear (etp_worker *wrk) 415etp_worker_clear (etp_worker *wrk)
400{ 416{
401} 417}
402 418
403static void ecb_cold 419static void ecb_cold
1086 todo -= len; 1102 todo -= len;
1087 } 1103 }
1088 1104
1089 FUBd; 1105 FUBd;
1090 1106
1091 errno = 0; 1107 /* linux's readahead basically only fails for EBADF or EINVAL (not mmappable) */
1108 /* but not for e.g. EIO or eof, so we also never fail */
1092 return count; 1109 return 0;
1093} 1110}
1094 1111
1095#endif 1112#endif
1096 1113
1097/* sendfile always needs emulation */ 1114/* sendfile always needs emulation */
1366} 1383}
1367 1384
1368/*****************************************************************************/ 1385/*****************************************************************************/
1369/* requests implemented outside eio_execute, because they are so large */ 1386/* requests implemented outside eio_execute, because they are so large */
1370 1387
1371/* copies some absolute path to tmpbuf */ 1388static void
1372static char * 1389eio__lseek (eio_req *req)
1373eio__getwd (struct tmpbuf *tmpbuf, eio_wd wd)
1374{ 1390{
1375 if (wd == EIO_CWD) 1391 /* this usually gets optimised away completely, or your compiler sucks, */
1376 return getcwd (tmpbuf->ptr, PATH_MAX); 1392 /* or the whence constants really are not 0, 1, 2 */
1393 int whence = req->int2 == EIO_SEEK_SET ? SEEK_SET
1394 : req->int2 == EIO_SEEK_CUR ? SEEK_CUR
1395 : req->int2 == EIO_SEEK_END ? SEEK_END
1396 : req->int2;
1377 1397
1378#if HAVE_AT 1398 req->offs = lseek (req->int1, req->offs, whence);
1379 abort (); /*TODO*/ 1399 req->result = req->offs == (off_t)-1 ? -1 : 0;
1380#else
1381 strcpy (tmpbuf->ptr, wd);
1382#endif
1383 return tmpbuf->ptr;
1384} 1400}
1385 1401
1386/* result will always end up in tmpbuf, there is always space for adding a 0-byte */ 1402/* result will always end up in tmpbuf, there is always space for adding a 0-byte */
1387static int 1403static int
1388eio__realpath (struct tmpbuf *tmpbuf, eio_wd wd, const char *path) 1404eio__realpath (struct tmpbuf *tmpbuf, eio_wd wd, const char *path)
1394 int symlinks = SYMLOOP_MAX; 1410 int symlinks = SYMLOOP_MAX;
1395#else 1411#else
1396 int symlinks = 32; 1412 int symlinks = 32;
1397#endif 1413#endif
1398 1414
1399 /*D*/ /*TODO: wd ignored */
1400
1401 errno = EINVAL; 1415 errno = EINVAL;
1402 if (!rel) 1416 if (!rel)
1403 return -1; 1417 return -1;
1404 1418
1405 errno = ENOENT; 1419 errno = ENOENT;
1433#endif 1447#endif
1434#endif 1448#endif
1435 1449
1436 if (*rel != '/') 1450 if (*rel != '/')
1437 { 1451 {
1438 if (!eio__getwd (tmpbuf, wd)) 1452 int len;
1453
1454 errno = ENOENT;
1455 if (wd == EIO_INVALID_WD)
1439 return -1; 1456 return -1;
1457
1458 if (wd == EIO_CWD)
1459 {
1460 if (!getcwd (res, PATH_MAX))
1461 return -1;
1462
1463 len = strlen (res);
1464 }
1465 else
1466 memcpy (res, wd->str, len = wd->len);
1440 1467
1441 if (res [1]) /* only use if not / */ 1468 if (res [1]) /* only use if not / */
1442 res += strlen (res); 1469 res += len;
1443 } 1470 }
1444 1471
1445 while (*rel) 1472 while (*rel)
1446 { 1473 {
1447 eio_ssize_t len, linklen; 1474 eio_ssize_t len, linklen;
1475 } 1502 }
1476 } 1503 }
1477 1504
1478 errno = ENAMETOOLONG; 1505 errno = ENAMETOOLONG;
1479 if (res + 1 + len + 1 >= tmp1) 1506 if (res + 1 + len + 1 >= tmp1)
1480 return; 1507 return -1;
1481 1508
1482 /* copy one component */ 1509 /* copy one component */
1483 *res = '/'; 1510 *res = '/';
1484 memcpy (res + 1, beg, len); 1511 memcpy (res + 1, beg, len);
1485 1512
1694 eio_dent_insertion_sort (dents, size); 1721 eio_dent_insertion_sort (dents, size);
1695} 1722}
1696 1723
1697/* read a full directory */ 1724/* read a full directory */
1698static void 1725static void
1699eio__scandir (eio_req *req) 1726eio__scandir (eio_req *req, etp_worker *self)
1700{ 1727{
1701 char *name, *names; 1728 char *name, *names;
1702 int namesalloc = 4096 - sizeof (void *) * 4; 1729 int namesalloc = 4096 - sizeof (void *) * 4;
1703 int namesoffs = 0; 1730 int namesoffs = 0;
1704 int flags = req->int1; 1731 int flags = req->int1;
1722#ifdef _WIN32 1749#ifdef _WIN32
1723 { 1750 {
1724 int len = strlen ((const char *)req->ptr1); 1751 int len = strlen ((const char *)req->ptr1);
1725 char *path = malloc (MAX_PATH); 1752 char *path = malloc (MAX_PATH);
1726 const char *fmt; 1753 const char *fmt;
1754 const char *reqpath = wd_expand (&self->tmpbuf, req->wd, req->ptr1);
1727 1755
1728 if (!len) 1756 if (!len)
1729 fmt = "./*"; 1757 fmt = "./*";
1730 else if (((const char *)req->ptr1)[len - 1] == '/' || ((const char *)req->ptr1)[len - 1] == '\\') 1758 else if (reqpath[len - 1] == '/' || reqpath[len - 1] == '\\')
1731 fmt = "%s*"; 1759 fmt = "%s*";
1732 else 1760 else
1733 fmt = "%s/*"; 1761 fmt = "%s/*";
1734 1762
1735 _snprintf (path, MAX_PATH, fmt, (const char *)req->ptr1); 1763 _snprintf (path, MAX_PATH, fmt, reqpath);
1736 dirp = FindFirstFile (path, &entp); 1764 dirp = FindFirstFile (path, &entp);
1737 free (path); 1765 free (path);
1738 1766
1739 if (dirp == INVALID_HANDLE_VALUE) 1767 if (dirp == INVALID_HANDLE_VALUE)
1740 { 1768 {
1762 1790
1763 return; 1791 return;
1764 } 1792 }
1765 } 1793 }
1766#else 1794#else
1795 #if HAVE_AT
1796 if (req->wd)
1797 {
1798 int fd = openat (WD2FD (req->wd), req->ptr1, O_CLOEXEC | O_SEARCH | O_DIRECTORY);
1799
1800 if (fd < 0)
1801 return;
1802
1803 dirp = fdopendir (fd);
1804
1805 if (!dirp)
1806 close (fd);
1807 }
1808 else
1767 dirp = opendir (req->ptr1); 1809 dirp = opendir (req->ptr1);
1810 #else
1811 dirp = opendir (wd_expand (&self->tmpbuf, req->wd, req->ptr1));
1812 #endif
1768 1813
1769 if (!dirp) 1814 if (!dirp)
1770 return; 1815 return;
1771#endif 1816#endif
1772 1817
1936 { 1981 {
1937 if (ent->type == EIO_DT_UNKNOWN) 1982 if (ent->type == EIO_DT_UNKNOWN)
1938 { 1983 {
1939 if (*name == '.') /* leading dots are likely directories, and, in any case, rare */ 1984 if (*name == '.') /* leading dots are likely directories, and, in any case, rare */
1940 ent->score = 1; 1985 ent->score = 1;
1941 else if (!strchr (name, '.')) /* absense of dots indicate likely dirs */ 1986 else if (!strchr (name, '.')) /* absence of dots indicate likely dirs */
1942 ent->score = len <= 2 ? 4 - len : len <= 4 ? 4 : len <= 7 ? 5 : 6; /* shorter == more likely dir, but avoid too many classes */ 1987 ent->score = len <= 2 ? 4 - len : len <= 4 ? 4 : len <= 7 ? 5 : 6; /* shorter == more likely dir, but avoid too many classes */
1943 } 1988 }
1944 else if (ent->type == EIO_DT_DIR) 1989 else if (ent->type == EIO_DT_DIR)
1945 ent->score = 0; 1990 ent->score = 0;
1946 } 1991 }
1966 } 2011 }
1967} 2012}
1968 2013
1969/*****************************************************************************/ 2014/*****************************************************************************/
1970/* working directory stuff */ 2015/* working directory stuff */
2016/* various deficiencies in the posix 2008 api force us to */
2017/* keep the absolute path in string form at all times */
2018/* fuck yeah. */
2019
2020#if !HAVE_AT
2021
2022/* a bit like realpath, but usually faster because it doesn'T have to return */
2023/* an absolute or canonical path */
2024static const char *
2025wd_expand (struct tmpbuf *tmpbuf, eio_wd wd, const char *path)
2026{
2027 if (!wd || *path == '/')
2028 return path;
2029
2030 if (path [0] == '.' && !path [1])
2031 return wd->str;
2032
2033 {
2034 int l1 = wd->len;
2035 int l2 = strlen (path);
2036
2037 char *res = tmpbuf_get (tmpbuf, l1 + l2 + 2);
2038
2039 memcpy (res, wd->str, l1);
2040 res [l1] = '/';
2041 memcpy (res + l1 + 1, path, l2 + 1);
2042
2043 return res;
2044 }
2045}
2046
2047#endif
2048
2049static eio_wd
2050eio__wd_open_sync (struct tmpbuf *tmpbuf, eio_wd wd, const char *path)
2051{
2052 int fd;
2053 eio_wd res;
2054 int len = eio__realpath (tmpbuf, wd, path);
2055
2056 if (len < 0)
2057 return EIO_INVALID_WD;
1971 2058
1972#if HAVE_AT 2059#if HAVE_AT
2060 fd = openat (WD2FD (wd), path, O_CLOEXEC | O_SEARCH | O_DIRECTORY);
1973 2061
1974#define WD2FD(wd) ((wd) ? ((int)(long)(wd)) - 1 : AT_FDCWD) 2062 if (fd < 0)
1975 2063 return EIO_INVALID_WD;
1976#ifndef O_SEARCH
1977# define O_SEARCH O_RDONLY
1978#endif 2064#endif
2065
2066 res = malloc (sizeof (*res) + len); /* one extra 0-byte */
2067
2068#if HAVE_AT
2069 res->fd = fd;
2070#endif
2071
2072 res->len = len;
2073 memcpy (res->str, tmpbuf->ptr, len);
2074 res->str [len] = 0;
2075
2076 return res;
2077}
1979 2078
1980eio_wd 2079eio_wd
1981eio_wd_open_sync (eio_wd wd, const char *path) 2080eio_wd_open_sync (eio_wd wd, const char *path)
1982{ 2081{
1983 int fd = openat (WD2FD (wd), path, O_CLOEXEC | O_SEARCH | O_DIRECTORY); 2082 struct tmpbuf tmpbuf = { 0 };
1984
1985 return fd >= 0 ? (eio_wd)(long)(fd + 1) : EIO_INVALID_WD;
1986}
1987
1988static eio_wd
1989eio__wd_open_sync (struct tmpbuf *tmpbuf, eio_wd wd, const char *path)
1990{
1991 return eio_wd_open_sync (wd, path); 2083 wd = eio__wd_open_sync (&tmpbuf, wd, path);
2084 free (tmpbuf.ptr);
2085
2086 return wd;
1992} 2087}
1993 2088
1994void 2089void
1995eio_wd_close_sync (eio_wd wd) 2090eio_wd_close_sync (eio_wd wd)
1996{ 2091{
1997 int fd = WD2FD (wd); 2092 if (wd != EIO_INVALID_WD && wd != EIO_CWD)
1998 2093 {
1999 if (fd >= 0) 2094 #if HAVE_AT
2000 close (fd); 2095 close (wd->fd);
2096 #endif
2097 free (wd);
2098 }
2001} 2099}
2100
2101#if HAVE_AT
2102
2103/* they forgot these */
2002 2104
2003static int 2105static int
2004eio__truncateat (int dirfd, const char *path, off_t length) 2106eio__truncateat (int dirfd, const char *path, off_t length)
2005{ 2107{
2006 int fd = openat (dirfd, path, O_WRONLY | O_CLOEXEC); 2108 int fd = openat (dirfd, path, O_WRONLY | O_CLOEXEC);
2025 2127
2026 res = fstatvfs (fd, buf); 2128 res = fstatvfs (fd, buf);
2027 close (fd); 2129 close (fd);
2028 return res; 2130 return res;
2029 2131
2030}
2031
2032#else
2033
2034/* on legacy systems, we represent the working directories simply by their path strings */
2035
2036static const char *
2037wd_expand (struct tmpbuf *tmpbuf, eio_wd wd, const char *path)
2038{
2039 if (!wd || *path == '/')
2040 return path;
2041
2042 {
2043 int l1 = strlen ((const char *)wd);
2044 int l2 = strlen (path);
2045
2046 char *res = tmpbuf_get (tmpbuf, l1 + l2 + 2);
2047
2048 memcpy (res, wd, l1);
2049 res [l1] = '/';
2050 memcpy (res + l1 + 1, path, l2 + 1);
2051
2052 return res;
2053 }
2054}
2055
2056static eio_wd
2057eio__wd_open_sync (struct tmpbuf *tmpbuf, eio_wd wd, const char *path)
2058{
2059 if (*path == '/') /* absolute paths ignore wd */
2060 path = strdup (path);
2061 else if (path [0] == '.' && !path [1]) /* special case '.', as it is common */
2062 return wd;
2063 else
2064 {
2065 int len = eio__realpath (tmpbuf, wd, path);
2066
2067 path = EIO_INVALID_WD;
2068
2069 if (len >= 0)
2070 {
2071 ((char *)tmpbuf->ptr)[len] = 0;
2072 path = strdup (tmpbuf->ptr);
2073 }
2074 }
2075
2076 if (!path)
2077 path = EIO_INVALID_WD;
2078
2079 return (eio_wd)path;
2080}
2081
2082eio_wd
2083eio_wd_open_sync (eio_wd wd, const char *path)
2084{
2085 struct tmpbuf tmpbuf = { 0 };
2086 wd = eio__wd_open_sync (&tmpbuf, wd, path);
2087 free (tmpbuf.ptr);
2088
2089 return wd;
2090}
2091
2092void
2093eio_wd_close_sync (eio_wd wd)
2094{
2095 if (wd != EIO_INVALID_WD)
2096 free (wd);
2097} 2132}
2098 2133
2099#endif 2134#endif
2100 2135
2101/*****************************************************************************/ 2136/*****************************************************************************/
2113 req->result = -1; \ 2148 req->result = -1; \
2114 break; \ 2149 break; \
2115 } \ 2150 } \
2116 } 2151 }
2117 2152
2153static void ecb_noinline ecb_cold
2154etp_proc_init (void)
2155{
2156#if HAVE_PRCTL_SET_NAME
2157 /* provide a more sensible "thread name" */
2158 char name[16 + 1];
2159 const int namelen = sizeof (name) - 1;
2160 int len;
2161
2162 prctl (PR_GET_NAME, (unsigned long)name, 0, 0, 0);
2163 name [namelen] = 0;
2164 len = strlen (name);
2165 strcpy (name + (len <= namelen - 4 ? len : namelen - 4), "/eio");
2166 prctl (PR_SET_NAME, (unsigned long)name, 0, 0, 0);
2167#endif
2168}
2169
2118X_THREAD_PROC (etp_proc) 2170X_THREAD_PROC (etp_proc)
2119{ 2171{
2120 ETP_REQ *req; 2172 ETP_REQ *req;
2121 struct timespec ts; 2173 struct timespec ts;
2122 etp_worker *self = (etp_worker *)thr_arg; 2174 etp_worker *self = (etp_worker *)thr_arg;
2123 2175
2124#if HAVE_PRCTL_SET_NAME 2176 etp_proc_init ();
2125 prctl (PR_SET_NAME, (unsigned long)"eio_thread", 0, 0, 0);
2126#endif
2127 2177
2128 /* try to distribute timeouts somewhat evenly */ 2178 /* try to distribute timeouts somewhat evenly */
2129 ts.tv_nsec = ((unsigned long)self & 1023UL) * (1000000000UL / 1024UL); 2179 ts.tv_nsec = ((unsigned long)self & 1023UL) * (1000000000UL / 1024UL);
2130 2180
2131 for (;;) 2181 for (;;)
2279 req->result = req->wd == EIO_INVALID_WD ? -1 : 0; 2329 req->result = req->wd == EIO_INVALID_WD ? -1 : 0;
2280 break; 2330 break;
2281 case EIO_WD_CLOSE: req->result = 0; 2331 case EIO_WD_CLOSE: req->result = 0;
2282 eio_wd_close_sync (req->wd); break; 2332 eio_wd_close_sync (req->wd); break;
2283 2333
2334 case EIO_SEEK: eio__lseek (req); break;
2284 case EIO_READ: ALLOC (req->size); 2335 case EIO_READ: ALLOC (req->size);
2285 req->result = req->offs >= 0 2336 req->result = req->offs >= 0
2286 ? pread (req->int1, req->ptr2, req->size, req->offs) 2337 ? pread (req->int1, req->ptr2, req->size, req->offs)
2287 : read (req->int1, req->ptr2, req->size); break; 2338 : read (req->int1, req->ptr2, req->size); break;
2288 case EIO_WRITE: req->result = req->offs >= 0 2339 case EIO_WRITE: req->result = req->offs >= 0
2304 case EIO_OPEN: req->result = openat (dirfd, req->ptr1, req->int1, (mode_t)req->int2); break; 2355 case EIO_OPEN: req->result = openat (dirfd, req->ptr1, req->int1, (mode_t)req->int2); break;
2305 2356
2306 case EIO_UNLINK: req->result = unlinkat (dirfd, req->ptr1, 0); break; 2357 case EIO_UNLINK: req->result = unlinkat (dirfd, req->ptr1, 0); break;
2307 case EIO_RMDIR: req->result = unlinkat (dirfd, req->ptr1, AT_REMOVEDIR); break; 2358 case EIO_RMDIR: req->result = unlinkat (dirfd, req->ptr1, AT_REMOVEDIR); break;
2308 case EIO_MKDIR: req->result = mkdirat (dirfd, req->ptr1, (mode_t)req->int2); break; 2359 case EIO_MKDIR: req->result = mkdirat (dirfd, req->ptr1, (mode_t)req->int2); break;
2309 case EIO_RENAME: req->result = renameat (dirfd, req->ptr1, WD2FD (req->int3), req->ptr2); break; 2360 case EIO_RENAME: req->result = renameat (dirfd, req->ptr1, WD2FD ((eio_wd)req->int3), req->ptr2); break;
2310 case EIO_LINK: req->result = linkat (dirfd, req->ptr1, WD2FD (req->int3), req->ptr2, 0); break; 2361 case EIO_LINK: req->result = linkat (dirfd, req->ptr1, WD2FD ((eio_wd)req->int3), req->ptr2, 0); break;
2311 case EIO_SYMLINK: req->result = symlinkat (req->ptr1, dirfd, req->ptr2); break; 2362 case EIO_SYMLINK: req->result = symlinkat (req->ptr1, dirfd, req->ptr2); break;
2312 case EIO_MKNOD: req->result = mknodat (dirfd, req->ptr1, (mode_t)req->int2, (dev_t)req->offs); break; 2363 case EIO_MKNOD: req->result = mknodat (dirfd, req->ptr1, (mode_t)req->int2, (dev_t)req->offs); break;
2313 case EIO_READLINK: ALLOC (PATH_MAX); 2364 case EIO_READLINK: ALLOC (PATH_MAX);
2314 req->result = readlinkat (dirfd, req->ptr1, req->ptr2, PATH_MAX); break; 2365 req->result = readlinkat (dirfd, req->ptr1, req->ptr2, PATH_MAX); break;
2315 case EIO_STATVFS: ALLOC (sizeof (EIO_STRUCT_STATVFS)); 2366 case EIO_STATVFS: ALLOC (sizeof (EIO_STRUCT_STATVFS));
2415 case EIO_MTOUCH: req->result = eio__mtouch (req); break; 2466 case EIO_MTOUCH: req->result = eio__mtouch (req); break;
2416 case EIO_MLOCK: req->result = eio__mlock (req->ptr2, req->size); break; 2467 case EIO_MLOCK: req->result = eio__mlock (req->ptr2, req->size); break;
2417 case EIO_MLOCKALL: req->result = eio__mlockall (req->int1); break; 2468 case EIO_MLOCKALL: req->result = eio__mlockall (req->int1); break;
2418 case EIO_FALLOCATE: req->result = eio__fallocate (req->int1, req->int2, req->offs, req->size); break; 2469 case EIO_FALLOCATE: req->result = eio__fallocate (req->int1, req->int2, req->offs, req->size); break;
2419 2470
2420 case EIO_READDIR: eio__scandir (req); break; 2471 case EIO_READDIR: eio__scandir (req, self); break;
2421 2472
2422 case EIO_BUSY: 2473 case EIO_BUSY:
2423#ifdef _WIN32 2474#ifdef _WIN32
2424 Sleep (req->nv1 * 1e3); 2475 Sleep (req->nv1 * 1e3);
2425#else 2476#else
2454 req->errorno = errno; 2505 req->errorno = errno;
2455} 2506}
2456 2507
2457#ifndef EIO_NO_WRAPPERS 2508#ifndef EIO_NO_WRAPPERS
2458 2509
2510eio_req *eio_wd_open (const char *path, int pri, eio_cb cb, void *data)
2511{
2512 REQ (EIO_WD_OPEN); PATH; SEND;
2513}
2514
2515eio_req *eio_wd_close (eio_wd wd, int pri, eio_cb cb, void *data)
2516{
2517 REQ (EIO_WD_CLOSE); req->wd = wd; SEND;
2518}
2519
2459eio_req *eio_nop (int pri, eio_cb cb, void *data) 2520eio_req *eio_nop (int pri, eio_cb cb, void *data)
2460{ 2521{
2461 REQ (EIO_NOP); SEND; 2522 REQ (EIO_NOP); SEND;
2462} 2523}
2463 2524
2522} 2583}
2523 2584
2524eio_req *eio_readahead (int fd, off_t offset, size_t length, int pri, eio_cb cb, void *data) 2585eio_req *eio_readahead (int fd, off_t offset, size_t length, int pri, eio_cb cb, void *data)
2525{ 2586{
2526 REQ (EIO_READAHEAD); req->int1 = fd; req->offs = offset; req->size = length; SEND; 2587 REQ (EIO_READAHEAD); req->int1 = fd; req->offs = offset; req->size = length; SEND;
2588}
2589
2590eio_req *eio_seek (int fd, off_t offset, int whence, int pri, eio_cb cb, void *data)
2591{
2592 REQ (EIO_SEEK); req->int1 = fd; req->offs = offset; req->int2 = whence; SEND;
2527} 2593}
2528 2594
2529eio_req *eio_read (int fd, void *buf, size_t length, off_t offset, int pri, eio_cb cb, void *data) 2595eio_req *eio_read (int fd, void *buf, size_t length, off_t offset, int pri, eio_cb cb, void *data)
2530{ 2596{
2531 REQ (EIO_READ); req->int1 = fd; req->offs = offset; req->size = length; req->ptr2 = buf; SEND; 2597 REQ (EIO_READ); req->int1 = fd; req->offs = offset; req->size = length; req->ptr2 = buf; SEND;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines