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

Comparing libeio/eio.c (file contents):
Revision 1.87 by root, Thu Jul 14 19:19:22 2011 UTC vs.
Revision 1.88 by root, Thu Jul 14 19:31:43 2011 UTC

878# undef pread 878# undef pread
879# undef pwrite 879# undef pwrite
880# define pread eio__pread 880# define pread eio__pread
881# define pwrite eio__pwrite 881# define pwrite eio__pwrite
882 882
883static ssize_t 883static eio_ssize_t
884eio__pread (int fd, void *buf, size_t count, off_t offset) 884eio__pread (int fd, void *buf, size_t count, off_t offset)
885{ 885{
886 ssize_t res; 886 eio_ssize_t res;
887 off_t ooffset; 887 off_t ooffset;
888 888
889 X_LOCK (preadwritelock); 889 X_LOCK (preadwritelock);
890 ooffset = lseek (fd, 0, SEEK_CUR); 890 ooffset = lseek (fd, 0, SEEK_CUR);
891 lseek (fd, offset, SEEK_SET); 891 lseek (fd, offset, SEEK_SET);
894 X_UNLOCK (preadwritelock); 894 X_UNLOCK (preadwritelock);
895 895
896 return res; 896 return res;
897} 897}
898 898
899static ssize_t 899static eio_ssize_t
900eio__pwrite (int fd, void *buf, size_t count, off_t offset) 900eio__pwrite (int fd, void *buf, size_t count, off_t offset)
901{ 901{
902 ssize_t res; 902 eio_ssize_t res;
903 off_t ooffset; 903 off_t ooffset;
904 904
905 X_LOCK (preadwritelock); 905 X_LOCK (preadwritelock);
906 ooffset = lseek (fd, 0, SEEK_CUR); 906 ooffset = lseek (fd, 0, SEEK_CUR);
907 lseek (fd, offset, SEEK_SET); 907 lseek (fd, offset, SEEK_SET);
996 996
997#if !HAVE_READAHEAD 997#if !HAVE_READAHEAD
998# undef readahead 998# undef readahead
999# define readahead(fd,offset,count) eio__readahead (fd, offset, count, self) 999# define readahead(fd,offset,count) eio__readahead (fd, offset, count, self)
1000 1000
1001static ssize_t 1001static eio_ssize_t
1002eio__readahead (int fd, off_t offset, size_t count, etp_worker *self) 1002eio__readahead (int fd, off_t offset, size_t count, etp_worker *self)
1003{ 1003{
1004 size_t todo = count; 1004 size_t todo = count;
1005 dBUF; 1005 dBUF;
1006 1006
1018} 1018}
1019 1019
1020#endif 1020#endif
1021 1021
1022/* sendfile always needs emulation */ 1022/* sendfile always needs emulation */
1023static ssize_t 1023static eio_ssize_t
1024eio__sendfile (int ofd, int ifd, off_t offset, size_t count, etp_worker *self) 1024eio__sendfile (int ofd, int ifd, off_t offset, size_t count, etp_worker *self)
1025{ 1025{
1026 ssize_t written = 0; 1026 eio_ssize_t written = 0;
1027 ssize_t res; 1027 eio_ssize_t res;
1028 1028
1029 if (!count) 1029 if (!count)
1030 return 0; 1030 return 0;
1031 1031
1032 for (;;) 1032 for (;;)
1141 1141
1142 res = 0; 1142 res = 0;
1143 1143
1144 while (count) 1144 while (count)
1145 { 1145 {
1146 ssize_t cnt; 1146 eio_ssize_t cnt;
1147 1147
1148 cnt = pread (ifd, eio_buf, count > EIO_BUFSIZE ? EIO_BUFSIZE : count, offset); 1148 cnt = pread (ifd, eio_buf, count > EIO_BUFSIZE ? EIO_BUFSIZE : count, offset);
1149 1149
1150 if (cnt <= 0) 1150 if (cnt <= 0)
1151 { 1151 {
1359 res += strlen (res); 1359 res += strlen (res);
1360 } 1360 }
1361 1361
1362 while (*rel) 1362 while (*rel)
1363 { 1363 {
1364 ssize_t len, linklen; 1364 eio_ssize_t len, linklen;
1365 char *beg = rel; 1365 char *beg = rel;
1366 1366
1367 while (*rel && *rel != '/') 1367 while (*rel && *rel != '/')
1368 ++rel; 1368 ++rel;
1369 1369
2180eio_req *eio_fchmod (int fd, mode_t mode, int pri, eio_cb cb, void *data) 2180eio_req *eio_fchmod (int fd, mode_t mode, int pri, eio_cb cb, void *data)
2181{ 2181{
2182 REQ (EIO_FCHMOD); req->int1 = fd; req->int2 = (long)mode; SEND; 2182 REQ (EIO_FCHMOD); req->int1 = fd; req->int2 = (long)mode; SEND;
2183} 2183}
2184 2184
2185eio_req *eio_fchown (int fd, uid_t uid, gid_t gid, int pri, eio_cb cb, void *data) 2185eio_req *eio_fchown (int fd, eio_uid_t uid, eio_gid_t gid, int pri, eio_cb cb, void *data)
2186{ 2186{
2187 REQ (EIO_FCHOWN); req->int1 = fd; req->int2 = (long)uid; req->int3 = (long)gid; SEND; 2187 REQ (EIO_FCHOWN); req->int1 = fd; req->int2 = (long)uid; req->int3 = (long)gid; SEND;
2188} 2188}
2189 2189
2190eio_req *eio_dup2 (int fd, int fd2, int pri, eio_cb cb, void *data) 2190eio_req *eio_dup2 (int fd, int fd2, int pri, eio_cb cb, void *data)
2210eio_req *eio_truncate (const char *path, off_t offset, int pri, eio_cb cb, void *data) 2210eio_req *eio_truncate (const char *path, off_t offset, int pri, eio_cb cb, void *data)
2211{ 2211{
2212 REQ (EIO_TRUNCATE); PATH; req->offs = offset; SEND; 2212 REQ (EIO_TRUNCATE); PATH; req->offs = offset; SEND;
2213} 2213}
2214 2214
2215eio_req *eio_chown (const char *path, uid_t uid, gid_t gid, int pri, eio_cb cb, void *data) 2215eio_req *eio_chown (const char *path, eio_uid_t uid, eio_gid_t gid, int pri, eio_cb cb, void *data)
2216{ 2216{
2217 REQ (EIO_CHOWN); PATH; req->int2 = (long)uid; req->int3 = (long)gid; SEND; 2217 REQ (EIO_CHOWN); PATH; req->int2 = (long)uid; req->int3 = (long)gid; SEND;
2218} 2218}
2219 2219
2220eio_req *eio_chmod (const char *path, mode_t mode, int pri, eio_cb cb, void *data) 2220eio_req *eio_chmod (const char *path, mode_t mode, int pri, eio_cb cb, void *data)
2367} 2367}
2368 2368
2369/*****************************************************************************/ 2369/*****************************************************************************/
2370/* misc garbage */ 2370/* misc garbage */
2371 2371
2372ssize_t 2372eio_ssize_t
2373eio_sendfile_sync (int ofd, int ifd, off_t offset, size_t count) 2373eio_sendfile_sync (int ofd, int ifd, off_t offset, size_t count)
2374{ 2374{
2375 etp_worker wrk; 2375 etp_worker wrk;
2376 ssize_t ret; 2376 eio_ssize_t ret;
2377 2377
2378 wrk.dbuf = 0; 2378 wrk.dbuf = 0;
2379 2379
2380 ret = eio__sendfile (ofd, ifd, offset, count, &wrk); 2380 ret = eio__sendfile (ofd, ifd, offset, count, &wrk);
2381 2381

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines