stoddard 00/02/21 08:41:42
Modified: src/include ap_iol.h src/lib/apr aprlib.def src/lib/apr/file_io/beos readwrite.c src/lib/apr/file_io/os2 fileio.h readwrite.c src/lib/apr/file_io/unix fileio.h readwrite.c src/lib/apr/file_io/win32 fileio.h readwrite.c src/lib/apr/include apr_file_io.h src/main buff.c iol_file.c src/modules/standard mod_rewrite.c Log: Make file I/O and network I/O writev/sendv APIs consistent. Eliminate use of ap_iovec_t and use Posix struct iovec. I never did hear a case (much less a strong case) supporting the need for ap_iovec_t, so out it goes. Revision Changes Path 1.11 +1 -1 apache-2.0/src/include/ap_iol.h Index: ap_iol.h =================================================================== RCS file: /home/cvs/apache-2.0/src/include/ap_iol.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- ap_iol.h 2000/02/18 18:05:15 1.10 +++ ap_iol.h 2000/02/21 16:41:38 1.11 @@ -106,7 +106,7 @@ ap_status_t (*close)(ap_iol *fd); ap_status_t (*write)(ap_iol *fd, const char *buf, ap_size_t len, ap_ssize_t *nbytes); - ap_status_t (*writev)(ap_iol *fd, const ap_iovec_t *vec, int nvec, + ap_status_t (*writev)(ap_iol *fd, const struct iovec *vec, int nvec, ap_ssize_t *nbytes); ap_status_t (*read)(ap_iol *fd, char *buf, ap_size_t len, ap_ssize_t *nbytes); 1.11 +1 -1 apache-2.0/src/lib/apr/aprlib.def Index: aprlib.def =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/aprlib.def,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- aprlib.def 2000/02/18 18:05:16 1.10 +++ aprlib.def 2000/02/21 16:41:39 1.11 @@ -20,7 +20,7 @@ ; ap_get_filesize @12 ; ap_get_fileatime @13 ; ap_get_filectime @14 - ap_make_iov @15 +; ap_make_iov @15 ap_dupfile @16 ap_getfileinfo @17 ap_open @18 1.7 +3 -15 apache-2.0/src/lib/apr/file_io/beos/readwrite.c Index: readwrite.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/beos/readwrite.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- readwrite.c 2000/02/05 12:05:06 1.6 +++ readwrite.c 2000/02/21 16:41:39 1.7 @@ -127,7 +127,7 @@ } /* ***APRDOC******************************************************** - * ap_status_t ap_writev(ap_file_t *, ap_iovec_t *, ap_ssize_t *) + * ap_status_t ap_writev(ap_file_t *, iovec *, ap_ssize_t *) * Write data from ap_iovec array to the specified file. * arg 1) The file descriptor to write to. * arg 2) The array from which to get the data to write to the file. @@ -138,22 +138,10 @@ * written on function exit. */ #ifdef HAVE_WRITEV - -ap_status_t ap_make_iov(struct iovec_t **new, struct iovec *iova, ap_context_t *cntxt) +ap_status_t ap_writev(struct file_t *thefile, const struct iovec *vec, ap_ssize_t *iocnt) { - (*new) = ap_palloc(cntxt, sizeof(struct iovec_t)); - if ((*new) == NULL) { - return APR_ENOMEM; - } - (*new)->cntxt = cntxt; - (*new)->theiov = iova; - return APR_SUCCESS; -} - -ap_status_t ap_writev(struct file_t *thefile, const struct iovec_t *vec, ap_ssize_t *iocnt) -{ int bytes; - if ((bytes = writev(thefile->filedes, vec->theiov, *iocnt)) < 0) { + if ((bytes = writev(thefile->filedes, vec, *iocnt)) < 0) { *iocnt = bytes; return errno; } 1.8 +0 -5 apache-2.0/src/lib/apr/file_io/os2/fileio.h Index: fileio.h =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/os2/fileio.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- fileio.h 2000/01/10 15:35:45 1.7 +++ fileio.h 2000/02/21 16:41:39 1.8 @@ -91,11 +91,6 @@ int validentry; }; -struct iovec_t { - ap_context_t *cntxt; - struct iovec *theiov; -}; - ap_status_t file_cleanup(void *); ap_status_t ap_os2_time_to_ap_time(ap_time_t *result, FDATE os2date, FTIME os2time); int os2errno( ULONG oserror ); 1.12 +2 -15 apache-2.0/src/lib/apr/file_io/os2/readwrite.c Index: readwrite.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/os2/readwrite.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- readwrite.c 2000/01/10 15:35:45 1.11 +++ readwrite.c 2000/02/21 16:41:39 1.12 @@ -183,23 +183,10 @@ #ifdef HAVE_WRITEV -ap_status_t ap_make_iov(struct iovec_t **new, struct iovec *iova, ap_context_t *cntxt) +ap_status_t ap_writev(struct file_t *thefile, const struct iovec *vec, ap_ssize_t *iocnt) { - (*new) = ap_palloc(cntxt, sizeof(struct iovec_t)); - if ((*new) == NULL) { - return APR_ENOMEM; - } - (*new)->cntxt = cntxt; - (*new)->theiov = iova; - return APR_SUCCESS; -} - - - -ap_status_t ap_writev(struct file_t *thefile, const struct iovec_t *vec, ap_ssize_t *iocnt) -{ int bytes; - if ((bytes = writev(thefile->filedes, vec->theiov, *iocnt)) < 0) { + if ((bytes = writev(thefile->filedes, vec, *iocnt)) < 0) { *iocnt = bytes; return errno; } 1.8 +0 -5 apache-2.0/src/lib/apr/file_io/unix/fileio.h Index: fileio.h =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/fileio.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- fileio.h 2000/01/06 14:43:07 1.7 +++ fileio.h 2000/02/21 16:41:40 1.8 @@ -120,11 +120,6 @@ struct dirent *entry; }; -struct iovec_t { - ap_context_t *cntxt; - struct iovec *theiov; -}; - ap_status_t file_cleanup(void *); mode_t get_fileperms(ap_fileperms_t); 1.21 +5 -17 apache-2.0/src/lib/apr/file_io/unix/readwrite.c Index: readwrite.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/readwrite.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- readwrite.c 2000/02/19 00:58:46 1.20 +++ readwrite.c 2000/02/21 16:41:40 1.21 @@ -201,34 +201,22 @@ } /* ***APRDOC******************************************************** - * ap_status_t ap_writev(ap_file_t *, ap_iovec_t *, ap_ssize_t *) - * Write data from ap_iovec array to the specified file. + * ap_status_t ap_writev(ap_file_t *, struct iovec *, ap_ssize_t *) + * Write data from iovec array to the specified file. * arg 1) The file descriptor to write to. * arg 2) The array from which to get the data to write to the file. - * arg 3) The number of elements in the ap_iovec array. This must be + * arg 3) The number of elements in the struct iovec array. This must be * smaller than AP_MAX_IOVEC_SIZE. If it isn't, the function will * fail with APR_EINVAL. * NOTE: The third arguement is updated with the number of bytes actually * written on function exit. */ #ifdef HAVE_WRITEV - -ap_status_t ap_make_iov(struct iovec_t **new, const struct iovec *iova, ap_context_t *cntxt) -{ - (*new) = ap_palloc(cntxt, sizeof(struct iovec_t)); - if ((*new) == NULL) { - return APR_ENOMEM; - } - (*new)->cntxt = cntxt; - (*new)->theiov = iova; - return APR_SUCCESS; -} - -ap_status_t ap_writev(struct file_t *thefile, const ap_iovec_t *vec, +ap_status_t ap_writev(struct file_t *thefile, const struct iovec *vec, ap_size_t nvec, ap_ssize_t *nbytes) { int bytes; - if ((bytes = writev(thefile->filedes, vec->theiov, nvec)) < 0) { + if ((bytes = writev(thefile->filedes, vec, nvec)) < 0) { *nbytes = 0; return errno; } 1.7 +0 -5 apache-2.0/src/lib/apr/file_io/win32/fileio.h Index: fileio.h =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/fileio.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- fileio.h 2000/02/18 02:53:11 1.6 +++ fileio.h 2000/02/21 16:41:40 1.7 @@ -120,11 +120,6 @@ WIN32_FIND_DATA *entry; }; -struct iovec_t { - ap_context_t *cntxt; - struct iovec *theiov; -}; - ap_status_t file_cleanup(void *); /*mode_t get_fileperms(ap_fileperms_t); */ 1.13 +2 -14 apache-2.0/src/lib/apr/file_io/win32/readwrite.c Index: readwrite.c =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/readwrite.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- readwrite.c 2000/02/18 18:05:17 1.12 +++ readwrite.c 2000/02/21 16:41:40 1.13 @@ -63,17 +63,6 @@ #define GetFilePointer(hfile) SetFilePointer(hfile,0,NULL, FILE_CURRENT) -ap_status_t ap_make_iov(struct iovec_t **new, const struct iovec *iova, ap_context_t *cntxt) -{ - (*new) = ap_palloc(cntxt, sizeof(struct iovec_t)); - if ((*new) == NULL) { - return APR_ENOMEM; - } - (*new)->cntxt = cntxt; - (*new)->theiov = iova; - return APR_SUCCESS; -} - ap_status_t ap_read(struct file_t *thefile, void *buf, ap_ssize_t *nbytes) { DWORD bread; @@ -128,17 +117,16 @@ /* * Too bad WriteFileGather() is not supported on 95&98 (or NT prior to SP2) */ -ap_status_t ap_writev(struct file_t *thefile, const ap_iovec_t *vec, ap_size_t nvec, +ap_status_t ap_writev(struct file_t *thefile, const struct iovec *vec, ap_size_t nvec, ap_ssize_t *nbytes) { int i; DWORD bwrote = 0; - struct iovec *iov = vec->theiov; *nbytes = 0; for (i = 0; i < nvec; i++) { if (!WriteFile(thefile->filehand, - iov[i].iov_base, iov[i].iov_len, &bwrote, NULL)) { + vec[i].iov_base, vec[i].iov_len, &bwrote, NULL)) { return GetLastError(); } *nbytes += bwrote; 1.31 +1 -3 apache-2.0/src/lib/apr/include/apr_file_io.h Index: apr_file_io.h =================================================================== RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_file_io.h,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- apr_file_io.h 2000/02/18 18:05:18 1.30 +++ apr_file_io.h 2000/02/21 16:41:41 1.31 @@ -108,7 +108,6 @@ typedef struct file_t ap_file_t; typedef struct ap_finfo_t ap_finfo_t; typedef struct dir_t ap_dir_t; -typedef struct iovec_t ap_iovec_t; typedef ap_int32_t ap_fileperms_t; typedef uid_t ap_uid_t; typedef gid_t ap_gid_t; @@ -136,7 +135,7 @@ ap_status_t ap_read(ap_file_t *, void *, ap_ssize_t *); ap_status_t ap_write(ap_file_t *, void *, ap_ssize_t *); -ap_status_t ap_writev(ap_file_t *, const ap_iovec_t *vec, ap_size_t nvec, ap_ssize_t *nbytes); +ap_status_t ap_writev(ap_file_t *, const struct iovec *vec, ap_size_t nvec, ap_ssize_t *nbytes); ap_status_t ap_putc(char, ap_file_t *); ap_status_t ap_getc(char *, ap_file_t *); ap_status_t ap_ungetc(char, ap_file_t *); @@ -146,7 +145,6 @@ API_EXPORT(int) ap_fprintf(ap_file_t *fptr, const char *format, ...) __attribute__((format(printf,2,3))); -ap_status_t ap_make_iov(ap_iovec_t **, const struct iovec *, ap_context_t *); ap_status_t ap_dupfile(ap_file_t **, ap_file_t *); ap_status_t ap_getfileinfo(ap_finfo_t *finfo, ap_file_t *thefile); ap_status_t ap_stat(ap_finfo_t *finfo, const char *fname, ap_context_t *cont); 1.31 +1 -3 apache-2.0/src/main/buff.c Index: buff.c =================================================================== RCS file: /home/cvs/apache-2.0/src/main/buff.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- buff.c 2000/02/18 18:05:19 1.30 +++ buff.c 2000/02/21 16:41:41 1.31 @@ -555,9 +555,7 @@ int nvec, ap_ssize_t *bytes_written) { ap_status_t rv; - ap_iovec_t *iov; - ap_make_iov(&iov, vec, fb->pool); - rv = iol_writev(fb->iol, iov, nvec, bytes_written); + rv = iol_writev(fb->iol, vec, nvec, bytes_written); if (rv != APR_SUCCESS) { fb->saved_errno = rv; if (rv != APR_EAGAIN) { 1.9 +1 -1 apache-2.0/src/main/iol_file.c Index: iol_file.c =================================================================== RCS file: /home/cvs/apache-2.0/src/main/iol_file.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- iol_file.c 2000/02/18 02:53:12 1.8 +++ iol_file.c 2000/02/21 16:41:41 1.9 @@ -86,7 +86,7 @@ method(ap_write, (ap_iol *viol, const char *arg1, ap_size_t arg2, ap_ssize_t *nbytes)) method(ap_read, (ap_iol *viol, char *arg1, ap_size_t arg2, ap_ssize_t *nbytes)) -static ap_status_t file_ap_writev(ap_iol *viol, const ap_iovec_t *vec, ap_size_t nvec, +static ap_status_t file_ap_writev(ap_iol *viol, const struct iovec *vec, ap_size_t nvec, ap_ssize_t *nbytes) { ap_status_t rv; 1.14 +1 -3 apache-2.0/src/modules/standard/mod_rewrite.c Index: mod_rewrite.c =================================================================== RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_rewrite.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- mod_rewrite.c 2000/02/18 02:53:12 1.13 +++ mod_rewrite.c 2000/02/21 16:41:41 1.14 @@ -2963,7 +2963,6 @@ ap_size_t nbytes; #ifndef NO_WRITEV - ap_iovec_t *iov; struct iovec iova[2]; ap_size_t niov; #endif @@ -2990,9 +2989,8 @@ iova[1].iov_base = "\n"; iova[1].iov_len = 1; - ap_make_iov(&iov, iova, r->pool); niov = 2; - ap_writev(fpin, iov, niov, &nbytes); + ap_writev(fpin, iova, niov, &nbytes); #endif /* read in the response value */