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

Comparing libeio/eio.c (file contents):
Revision 1.130 by root, Thu May 9 03:03:24 2013 UTC vs.
Revision 1.143 by root, Sat Dec 3 16:33:46 2016 UTC

1/* 1/*
2 * libeio implementation 2 * libeio implementation
3 * 3 *
4 * Copyright (c) 2007,2008,2009,2010,2011,2012,2013 Marc Alexander Lehmann <libeio@schmorp.de> 4 * Copyright (c) 2007,2008,2009,2010,2011,2012,2013,2016 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 *
42#endif 42#endif
43 43
44#include "eio.h" 44#include "eio.h"
45#include "ecb.h" 45#include "ecb.h"
46 46
47#ifdef EIO_STACKSIZE
48# define X_STACKSIZE EIO_STACKSIZE
49#endif
50#include "xthread.h"
51
52#include <errno.h> 47#include <errno.h>
53#include <stddef.h> 48#include <stddef.h>
54#include <stdlib.h> 49#include <stdlib.h>
55#include <string.h> 50#include <string.h>
56#include <errno.h> 51#include <errno.h>
120 #define link(old,neu) (CreateHardLink (neu, old, 0) ? 0 : EIO_ERRNO (ENOENT, -1)) 115 #define link(old,neu) (CreateHardLink (neu, old, 0) ? 0 : EIO_ERRNO (ENOENT, -1))
121 116
122 #define chmod(path,mode) _chmod (path, mode) 117 #define chmod(path,mode) _chmod (path, mode)
123 #define dup(fd) _dup (fd) 118 #define dup(fd) _dup (fd)
124 #define dup2(fd1,fd2) _dup2 (fd1, fd2) 119 #define dup2(fd1,fd2) _dup2 (fd1, fd2)
120 #define pipe(fds) _pipe (fds, 4096, O_BINARY)
125 121
122 #define fcntl(fd,cmd,arg) EIO_ENOSYS ()
123 #define ioctl(fd,cmd,arg) EIO_ENOSYS ()
126 #define fchmod(fd,mode) EIO_ENOSYS () 124 #define fchmod(fd,mode) EIO_ENOSYS ()
127 #define chown(path,uid,gid) EIO_ENOSYS () 125 #define chown(path,uid,gid) EIO_ENOSYS ()
128 #define fchown(fd,uid,gid) EIO_ENOSYS () 126 #define fchown(fd,uid,gid) EIO_ENOSYS ()
129 #define truncate(path,offs) EIO_ENOSYS () /* far-miss: SetEndOfFile */ 127 #define truncate(path,offs) EIO_ENOSYS () /* far-miss: SetEndOfFile */
130 #define ftruncate(fd,offs) EIO_ENOSYS () /* near-miss: SetEndOfFile */ 128 #define ftruncate(fd,offs) EIO_ENOSYS () /* near-miss: SetEndOfFile */
203 /* we could even stat and see if it exists */ 201 /* we could even stat and see if it exists */
204 static int 202 static int
205 symlink (const char *old, const char *neu) 203 symlink (const char *old, const char *neu)
206 { 204 {
207 #if WINVER >= 0x0600 205 #if WINVER >= 0x0600
206 int flags;
207
208 /* This tries out all combinations of SYMBOLIC_LINK_FLAG_DIRECTORY
209 * and SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE,
210 * with directory first.
211 */
212 for (flags = 3; flags >= 0; --flags)
208 if (CreateSymbolicLink (neu, old, 1)) 213 if (CreateSymbolicLink (neu, old, flags))
209 return 0; 214 return 0;
210
211 if (CreateSymbolicLink (neu, old, 0))
212 return 0;
213 #endif 215 #endif
214 216
215 return EIO_ERRNO (ENOENT, -1); 217 return EIO_ERRNO (ENOENT, -1);
216 } 218 }
217 219
280# include <utime.h> 282# include <utime.h>
281#endif 283#endif
282 284
283#if HAVE_SYS_SYSCALL_H 285#if HAVE_SYS_SYSCALL_H
284# include <sys/syscall.h> 286# include <sys/syscall.h>
285#endif
286
287#if HAVE_SYS_PRCTL_H
288# include <sys/prctl.h>
289#endif 287#endif
290 288
291#if HAVE_SENDFILE 289#if HAVE_SENDFILE
292# if __linux 290# if __linux
293# include <sys/sendfile.h> 291# include <sys/sendfile.h>
335#define FUBd \ 333#define FUBd \
336 free (eio_buf) 334 free (eio_buf)
337 335
338/*****************************************************************************/ 336/*****************************************************************************/
339 337
340struct tmpbuf
341{
342 void *ptr;
343 int len;
344};
345
346static void *
347tmpbuf_get (struct tmpbuf *buf, int len)
348{
349 if (buf->len < len)
350 {
351 free (buf->ptr);
352 buf->ptr = malloc (buf->len = len);
353 }
354
355 return buf->ptr;
356}
357
358struct tmpbuf; 338struct etp_tmpbuf;
359 339
360#if _POSIX_VERSION >= 200809L 340#if _POSIX_VERSION >= 200809L
361 #define HAVE_AT 1 341 #define HAVE_AT 1
362 #define WD2FD(wd) ((wd) ? (wd)->fd : AT_FDCWD) 342 #define WD2FD(wd) ((wd) ? (wd)->fd : AT_FDCWD)
363 #ifndef O_SEARCH 343 #ifndef O_SEARCH
364 #define O_SEARCH O_RDONLY 344 #define O_SEARCH O_RDONLY
365 #endif 345 #endif
366#else 346#else
367 #define HAVE_AT 0 347 #define HAVE_AT 0
368 static const char *wd_expand (struct tmpbuf *tmpbuf, eio_wd wd, const char *path); 348 static const char *wd_expand (struct etp_tmpbuf *tmpbuf, eio_wd wd, const char *path);
369#endif 349#endif
370 350
371struct eio_pwd 351struct eio_pwd
372{ 352{
373#if HAVE_AT 353#if HAVE_AT
383#define ETP_PRI_MAX EIO_PRI_MAX 363#define ETP_PRI_MAX EIO_PRI_MAX
384 364
385#define ETP_TYPE_QUIT -1 365#define ETP_TYPE_QUIT -1
386#define ETP_TYPE_GROUP EIO_GROUP 366#define ETP_TYPE_GROUP EIO_GROUP
387 367
368static void eio_nop_callback (void) { }
369static void (*eio_want_poll_cb)(void) = eio_nop_callback;
370static void (*eio_done_poll_cb)(void) = eio_nop_callback;
371
372#define ETP_WANT_POLL(pool) eio_want_poll_cb ()
373#define ETP_DONE_POLL(pool) eio_done_poll_cb ()
374
388struct etp_worker; 375struct etp_worker;
389
390#define ETP_REQ eio_req 376#define ETP_REQ eio_req
391#define ETP_DESTROY(req) eio_destroy (req) 377#define ETP_DESTROY(req) eio_destroy (req)
392static int eio_finish (eio_req *req); 378static int eio_finish (eio_req *req);
393#define ETP_FINISH(req) eio_finish (req) 379#define ETP_FINISH(req) eio_finish (req)
394static void eio_execute (struct etp_worker *self, eio_req *req); 380static void eio_execute (struct etp_worker *self, eio_req *req);
395#define ETP_EXECUTE(wrk,req) eio_execute (wrk, req) 381#define ETP_EXECUTE(wrk,req) eio_execute (wrk, req)
396 382
397#include "etp.c" 383#include "etp.c"
398 384
385static struct etp_pool eio_pool;
386#define EIO_POOL (&eio_pool)
387
399/*****************************************************************************/ 388/*****************************************************************************/
400 389
401static void 390static void
402grp_try_feed (eio_req *grp) 391grp_try_feed (eio_req *grp)
403{ 392{
404 while (grp->size < grp->int2 && !EIO_CANCELLED (grp)) 393 while (grp->size < grp->int2 && !EIO_CANCELLED (grp))
405 { 394 {
406 grp->flags &= ~EIO_FLAG_GROUPADD; 395 grp->flags &= ~ETP_FLAG_GROUPADD;
407 396
408 EIO_FEED (grp); 397 EIO_FEED (grp);
409 398
410 /* stop if no progress has been made */ 399 /* stop if no progress has been made */
411 if (!(grp->flags & EIO_FLAG_GROUPADD)) 400 if (!(grp->flags & ETP_FLAG_GROUPADD))
412 { 401 {
413 grp->feed = 0; 402 grp->feed = 0;
414 break; 403 break;
415 } 404 }
416 } 405 }
423 412
424 /* call feeder, if applicable */ 413 /* call feeder, if applicable */
425 grp_try_feed (grp); 414 grp_try_feed (grp);
426 415
427 /* finish, if done */ 416 /* finish, if done */
428 if (!grp->size && grp->int1) 417 if (!grp->size && grp->flags & ETP_FLAG_DELAYED)
429 return eio_finish (grp); 418 return eio_finish (grp);
430 else 419 else
431 return 0; 420 return 0;
432} 421}
433 422
469} 458}
470 459
471void 460void
472eio_grp_cancel (eio_req *grp) 461eio_grp_cancel (eio_req *grp)
473{ 462{
474 etp_grp_cancel (grp); 463 etp_grp_cancel (EIO_POOL, grp);
475} 464}
476 465
477void 466void
478eio_cancel (eio_req *req) 467eio_cancel (eio_req *req)
479{ 468{
480 etp_cancel (req); 469 etp_cancel (EIO_POOL, req);
481} 470}
482 471
483void 472void
484eio_submit (eio_req *req) 473eio_submit (eio_req *req)
485{ 474{
486 etp_submit (req); 475 etp_submit (EIO_POOL, req);
487} 476}
488 477
489unsigned int 478unsigned int
490eio_nreqs (void) 479eio_nreqs (void)
491{ 480{
492 return etp_nreqs (); 481 return etp_nreqs (EIO_POOL);
493} 482}
494 483
495unsigned int 484unsigned int
496eio_nready (void) 485eio_nready (void)
497{ 486{
498 return etp_nready (); 487 return etp_nready (EIO_POOL);
499} 488}
500 489
501unsigned int 490unsigned int
502eio_npending (void) 491eio_npending (void)
503{ 492{
504 return etp_npending (); 493 return etp_npending (EIO_POOL);
505} 494}
506 495
507unsigned int ecb_cold 496unsigned int ecb_cold
508eio_nthreads (void) 497eio_nthreads (void)
509{ 498{
510 return etp_nthreads (); 499 return etp_nthreads (EIO_POOL);
511} 500}
512 501
513void ecb_cold 502void ecb_cold
514eio_set_max_poll_time (double nseconds) 503eio_set_max_poll_time (double nseconds)
515{ 504{
516 etp_set_max_poll_time (nseconds); 505 etp_set_max_poll_time (EIO_POOL, nseconds);
517} 506}
518 507
519void ecb_cold 508void ecb_cold
520eio_set_max_poll_reqs (unsigned int maxreqs) 509eio_set_max_poll_reqs (unsigned int maxreqs)
521{ 510{
522 etp_set_max_poll_reqs (maxreqs); 511 etp_set_max_poll_reqs (EIO_POOL, maxreqs);
523} 512}
524 513
525void ecb_cold 514void ecb_cold
526eio_set_max_idle (unsigned int nthreads) 515eio_set_max_idle (unsigned int nthreads)
527{ 516{
528 etp_set_max_idle (nthreads); 517 etp_set_max_idle (EIO_POOL, nthreads);
529} 518}
530 519
531void ecb_cold 520void ecb_cold
532eio_set_idle_timeout (unsigned int seconds) 521eio_set_idle_timeout (unsigned int seconds)
533{ 522{
534 etp_set_idle_timeout (seconds); 523 etp_set_idle_timeout (EIO_POOL, seconds);
535} 524}
536 525
537void ecb_cold 526void ecb_cold
538eio_set_min_parallel (unsigned int nthreads) 527eio_set_min_parallel (unsigned int nthreads)
539{ 528{
540 etp_set_min_parallel (nthreads); 529 etp_set_min_parallel (EIO_POOL, nthreads);
541} 530}
542 531
543void ecb_cold 532void ecb_cold
544eio_set_max_parallel (unsigned int nthreads) 533eio_set_max_parallel (unsigned int nthreads)
545{ 534{
546 etp_set_max_parallel (nthreads); 535 etp_set_max_parallel (EIO_POOL, nthreads);
547} 536}
548 537
549int eio_poll (void) 538int eio_poll (void)
550{ 539{
551 return etp_poll (); 540 return etp_poll (EIO_POOL);
552} 541}
553 542
554/*****************************************************************************/ 543/*****************************************************************************/
555/* work around various missing functions */ 544/* work around various missing functions */
556 545
966 req->result = req->offs == (off_t)-1 ? -1 : 0; 955 req->result = req->offs == (off_t)-1 ? -1 : 0;
967} 956}
968 957
969/* result will always end up in tmpbuf, there is always space for adding a 0-byte */ 958/* result will always end up in tmpbuf, there is always space for adding a 0-byte */
970static int 959static int
971eio__realpath (struct tmpbuf *tmpbuf, eio_wd wd, const char *path) 960eio__realpath (struct etp_tmpbuf *tmpbuf, eio_wd wd, const char *path)
972{ 961{
973 char *res; 962 char *res;
974 const char *rel = path; 963 const char *rel = path;
975 char *tmp1, *tmp2; 964 char *tmp1, *tmp2;
976#if SYMLOOP_MAX > 32 965#if SYMLOOP_MAX > 32
985 974
986 errno = ENOENT; 975 errno = ENOENT;
987 if (!*rel) 976 if (!*rel)
988 return -1; 977 return -1;
989 978
990 res = tmpbuf_get (tmpbuf, PATH_MAX * 3); 979 res = etp_tmpbuf_get (tmpbuf, PATH_MAX * 3);
991#ifdef _WIN32 980#ifdef _WIN32
992 if (_access (rel, 4) != 0) 981 if (_access (rel, 4) != 0)
993 return -1; 982 return -1;
994 983
995 symlinks = GetFullPathName (rel, PATH_MAX * 3, res, 0); 984 symlinks = GetFullPathName (rel, PATH_MAX * 3, res, 0);
1604#if !HAVE_AT 1593#if !HAVE_AT
1605 1594
1606/* a bit like realpath, but usually faster because it doesn'T have to return */ 1595/* a bit like realpath, but usually faster because it doesn'T have to return */
1607/* an absolute or canonical path */ 1596/* an absolute or canonical path */
1608static const char * 1597static const char *
1609wd_expand (struct tmpbuf *tmpbuf, eio_wd wd, const char *path) 1598wd_expand (struct etp_tmpbuf *tmpbuf, eio_wd wd, const char *path)
1610{ 1599{
1611 if (!wd || *path == '/') 1600 if (!wd || *path == '/')
1612 return path; 1601 return path;
1613 1602
1614 if (path [0] == '.' && !path [1]) 1603 if (path [0] == '.' && !path [1])
1616 1605
1617 { 1606 {
1618 int l1 = wd->len; 1607 int l1 = wd->len;
1619 int l2 = strlen (path); 1608 int l2 = strlen (path);
1620 1609
1621 char *res = tmpbuf_get (tmpbuf, l1 + l2 + 2); 1610 char *res = etp_tmpbuf_get (tmpbuf, l1 + l2 + 2);
1622 1611
1623 memcpy (res, wd->str, l1); 1612 memcpy (res, wd->str, l1);
1624 res [l1] = '/'; 1613 res [l1] = '/';
1625 memcpy (res + l1 + 1, path, l2 + 1); 1614 memcpy (res + l1 + 1, path, l2 + 1);
1626 1615
1629} 1618}
1630 1619
1631#endif 1620#endif
1632 1621
1633static eio_wd 1622static eio_wd
1634eio__wd_open_sync (struct tmpbuf *tmpbuf, eio_wd wd, const char *path) 1623eio__wd_open_sync (struct etp_tmpbuf *tmpbuf, eio_wd wd, const char *path)
1635{ 1624{
1636 int fd; 1625 int fd;
1637 eio_wd res; 1626 eio_wd res;
1638 int len = eio__realpath (tmpbuf, wd, path); 1627 int len = eio__realpath (tmpbuf, wd, path);
1639 1628
1661} 1650}
1662 1651
1663eio_wd 1652eio_wd
1664eio_wd_open_sync (eio_wd wd, const char *path) 1653eio_wd_open_sync (eio_wd wd, const char *path)
1665{ 1654{
1666 struct tmpbuf tmpbuf = { 0 }; 1655 struct etp_tmpbuf tmpbuf = { };
1667 wd = eio__wd_open_sync (&tmpbuf, wd, path); 1656 wd = eio__wd_open_sync (&tmpbuf, wd, path);
1668 free (tmpbuf.ptr); 1657 free (tmpbuf.ptr);
1669 1658
1670 return wd; 1659 return wd;
1671} 1660}
1720/*****************************************************************************/ 1709/*****************************************************************************/
1721 1710
1722#define ALLOC(len) \ 1711#define ALLOC(len) \
1723 if (!req->ptr2) \ 1712 if (!req->ptr2) \
1724 { \ 1713 { \
1725 X_LOCK (wrklock); \ 1714 X_LOCK (EIO_POOL->wrklock); \
1726 req->flags |= EIO_FLAG_PTR2_FREE; \ 1715 req->flags |= EIO_FLAG_PTR2_FREE; \
1727 X_UNLOCK (wrklock); \ 1716 X_UNLOCK (EIO_POOL->wrklock); \
1728 req->ptr2 = malloc (len); \ 1717 req->ptr2 = malloc (len); \
1729 if (!req->ptr2) \ 1718 if (!req->ptr2) \
1730 { \ 1719 { \
1731 errno = ENOMEM; \ 1720 errno = ENOMEM; \
1732 req->result = -1; \ 1721 req->result = -1; \
1733 break; \ 1722 break; \
1734 } \ 1723 } \
1735 } 1724 }
1736 1725
1737static void ecb_noinline ecb_cold
1738etp_proc_init (void)
1739{
1740#if HAVE_PRCTL_SET_NAME
1741 /* provide a more sensible "thread name" */
1742 char name[16 + 1];
1743 const int namelen = sizeof (name) - 1;
1744 int len;
1745
1746 prctl (PR_GET_NAME, (unsigned long)name, 0, 0, 0);
1747 name [namelen] = 0;
1748 len = strlen (name);
1749 strcpy (name + (len <= namelen - 4 ? len : namelen - 4), "/eio");
1750 prctl (PR_SET_NAME, (unsigned long)name, 0, 0, 0);
1751#endif
1752}
1753
1754/* TODO: move somehow to etp.c */
1755X_THREAD_PROC (etp_proc)
1756{
1757 ETP_REQ *req;
1758 struct timespec ts;
1759 etp_worker *self = (etp_worker *)thr_arg;
1760
1761 etp_proc_init ();
1762
1763 /* try to distribute timeouts somewhat evenly */
1764 ts.tv_nsec = ((unsigned long)self & 1023UL) * (1000000000UL / 1024UL);
1765
1766 for (;;)
1767 {
1768 ts.tv_sec = 0;
1769
1770 X_LOCK (reqlock);
1771
1772 for (;;)
1773 {
1774 req = reqq_shift (&req_queue);
1775
1776 if (req)
1777 break;
1778
1779 if (ts.tv_sec == 1) /* no request, but timeout detected, let's quit */
1780 {
1781 X_UNLOCK (reqlock);
1782 X_LOCK (wrklock);
1783 --started;
1784 X_UNLOCK (wrklock);
1785 goto quit;
1786 }
1787
1788 ++idle;
1789
1790 if (idle <= max_idle)
1791 /* we are allowed to idle, so do so without any timeout */
1792 X_COND_WAIT (reqwait, reqlock);
1793 else
1794 {
1795 /* initialise timeout once */
1796 if (!ts.tv_sec)
1797 ts.tv_sec = time (0) + idle_timeout;
1798
1799 if (X_COND_TIMEDWAIT (reqwait, reqlock, ts) == ETIMEDOUT)
1800 ts.tv_sec = 1; /* assuming this is not a value computed above.,.. */
1801 }
1802
1803 --idle;
1804 }
1805
1806 --nready;
1807
1808 X_UNLOCK (reqlock);
1809
1810 if (req->type == ETP_TYPE_QUIT)
1811 goto quit;
1812
1813 ETP_EXECUTE (self, req);
1814
1815 X_LOCK (reslock);
1816
1817 ++npending;
1818
1819 if (!reqq_push (&res_queue, req) && want_poll_cb)
1820 want_poll_cb ();
1821
1822 etp_worker_clear (self);
1823
1824 X_UNLOCK (reslock);
1825 }
1826
1827quit:
1828 free (req);
1829
1830 X_LOCK (wrklock);
1831 etp_worker_free (self);
1832 X_UNLOCK (wrklock);
1833
1834 return 0;
1835}
1836
1837/*****************************************************************************/ 1726/*****************************************************************************/
1838 1727
1839int ecb_cold 1728int ecb_cold
1840eio_init (void (*want_poll)(void), void (*done_poll)(void)) 1729eio_init (void (*want_poll)(void), void (*done_poll)(void))
1841{ 1730{
1842 return etp_init (want_poll, done_poll); 1731 eio_want_poll_cb = want_poll;
1732 eio_done_poll_cb = done_poll;
1733
1734 return etp_init (EIO_POOL, 0, 0, 0);
1843} 1735}
1844 1736
1845ecb_inline void 1737ecb_inline void
1846eio_api_destroy (eio_req *req) 1738eio_api_destroy (eio_req *req)
1847{ 1739{
1920 ? pread (req->int1, req->ptr2, req->size, req->offs) 1812 ? pread (req->int1, req->ptr2, req->size, req->offs)
1921 : read (req->int1, req->ptr2, req->size); break; 1813 : read (req->int1, req->ptr2, req->size); break;
1922 case EIO_WRITE: req->result = req->offs >= 0 1814 case EIO_WRITE: req->result = req->offs >= 0
1923 ? pwrite (req->int1, req->ptr2, req->size, req->offs) 1815 ? pwrite (req->int1, req->ptr2, req->size, req->offs)
1924 : write (req->int1, req->ptr2, req->size); break; 1816 : write (req->int1, req->ptr2, req->size); break;
1817
1818 case EIO_FCNTL: req->result = fcntl (req->int1, (int) req->int2, req->ptr2); break;
1819 case EIO_IOCTL: req->result = ioctl (req->int1, (unsigned long)req->int2, req->ptr2); break;
1925 1820
1926 case EIO_READAHEAD: req->result = readahead (req->int1, req->offs, req->size); break; 1821 case EIO_READAHEAD: req->result = readahead (req->int1, req->offs, req->size); break;
1927 case EIO_SENDFILE: req->result = eio__sendfile (req->int1, req->int2, req->offs, req->size); break; 1822 case EIO_SENDFILE: req->result = eio__sendfile (req->int1, req->int2, req->offs, req->size); break;
1928 1823
1929#if HAVE_AT 1824#if HAVE_AT
2072 req->result = select (0, 0, 0, 0, &tv); 1967 req->result = select (0, 0, 0, 0, &tv);
2073 } 1968 }
2074#endif 1969#endif
2075 break; 1970 break;
2076 1971
1972#if 0
2077 case EIO_GROUP: 1973 case EIO_GROUP:
2078 abort (); /* handled in eio_request */ 1974 abort (); /* handled in eio_request */
1975#endif
2079 1976
2080 case EIO_NOP: 1977 case EIO_NOP:
2081 req->result = 0; 1978 req->result = 0;
2082 break; 1979 break;
2083 1980
2186} 2083}
2187 2084
2188eio_req *eio_write (int fd, void *buf, size_t length, off_t offset, int pri, eio_cb cb, void *data) 2085eio_req *eio_write (int fd, void *buf, size_t length, off_t offset, int pri, eio_cb cb, void *data)
2189{ 2086{
2190 REQ (EIO_WRITE); req->int1 = fd; req->offs = offset; req->size = length; req->ptr2 = buf; SEND; 2087 REQ (EIO_WRITE); req->int1 = fd; req->offs = offset; req->size = length; req->ptr2 = buf; SEND;
2088}
2089
2090eio_req *eio_fcntl (int fd, int cmd, void *arg, int pri, eio_cb cb, void *data)
2091{
2092 REQ (EIO_IOCTL); req->int1 = fd; req->int2 = cmd; req->ptr2 = arg; SEND;
2093}
2094
2095eio_req *eio_ioctl (int fd, unsigned long request, void *buf, int pri, eio_cb cb, void *data)
2096{
2097 REQ (EIO_IOCTL); req->int1 = fd; req->int2 = request; req->ptr2 = buf; SEND;
2191} 2098}
2192 2099
2193eio_req *eio_fstat (int fd, int pri, eio_cb cb, void *data) 2100eio_req *eio_fstat (int fd, int pri, eio_cb cb, void *data)
2194{ 2101{
2195 REQ (EIO_FSTAT); req->int1 = fd; SEND; 2102 REQ (EIO_FSTAT); req->int1 = fd; SEND;
2383void 2290void
2384eio_grp_add (eio_req *grp, eio_req *req) 2291eio_grp_add (eio_req *grp, eio_req *req)
2385{ 2292{
2386 assert (("cannot add requests to IO::AIO::GRP after the group finished", grp->int1 != 2)); 2293 assert (("cannot add requests to IO::AIO::GRP after the group finished", grp->int1 != 2));
2387 2294
2388 grp->flags |= EIO_FLAG_GROUPADD; 2295 grp->flags |= ETP_FLAG_GROUPADD;
2389 2296
2390 ++grp->size; 2297 ++grp->size;
2391 req->grp = grp; 2298 req->grp = grp;
2392 2299
2393 req->grp_prev = 0; 2300 req->grp_prev = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines