rbb 99/06/01 05:05:43
Modified: include apr_file_io.h
apr/file_io/unix dir.c fileacc.c filedup.c filestat.c open.c
Log:
Started to move documentation into the code. I'll be doing this slowly but
it will get done in time.
Revision Changes Path
1.32 +0 -1 apache-apr/include/apr_file_io.h
Index: apr_file_io.h
===================================================================
RCS file: /home/cvs/apache-apr/include/apr_file_io.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- apr_file_io.h 1999/05/26 13:47:03 1.31
+++ apr_file_io.h 1999/06/01 12:05:41 1.32
@@ -114,7 +114,6 @@
ap_status_t ap_dupfile(ap_file_t *, ap_file_t **);
ap_status_t ap_getfileinfo(ap_file_t *);
-ap_status_t ap_updatefileinfo(ap_file_t *);
ap_status_t ap_seek(ap_file_t *, ap_seek_where_t, ap_off_t *);
ap_status_t ap_opendir(ap_context_t *, const char *, ap_dir_t **);
1.12 +60 -1 apache-apr/apr/file_io/unix/dir.c
Index: dir.c
===================================================================
RCS file: /home/cvs/apache-apr/apr/file_io/unix/dir.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- dir.c 1999/05/25 03:14:14 1.11
+++ dir.c 1999/06/01 12:05:41 1.12
@@ -71,7 +71,13 @@
return errno;
}
}
-
+/* ***APRDOC********************************************************
+ * ap_status_t ap_opendir(ap_context_t *, char *, ap_dir_t **)
+ * Open the specified directory.
+ * arg 1) The context to use.
+ * arg 2) The full path to the directory (use / on all systems)
+ * arg 3) The opened directory descriptor.
+ */
ap_status_t ap_opendir(ap_context_t *cont, const char *dirname, struct dir_t
**new)
{
(*new) = (struct dir_t *)ap_palloc(cont->pool, sizeof(struct dir_t));
@@ -91,6 +97,11 @@
}
}
+/* ***APRDOC********************************************************
+ * ap_status_t ap_closedir(ap_dir_t *)
+ * close the specified directory.
+ * arg 1) the directory descriptor to close.
+ */
ap_status_t ap_closedir(struct dir_t *thedir)
{
ap_status_t rv;
@@ -102,6 +113,12 @@
return rv;
}
+/* ***APRDOC********************************************************
+ * ap_status_t ap_readdir(ap_dir_t *)
+ * Read the next entry from the specified directory.
+ * arg 1) the directory descriptor to read from, and fill out.
+ * NOTE: All systems return . and .. as the first two files.
+ */
ap_status_t ap_readdir(struct dir_t *thedir)
{
thedir->entry = readdir(thedir->dirstruct);
@@ -111,12 +128,24 @@
return APR_SUCCESS;
}
+/* ***APRDOC********************************************************
+ * ap_status_t ap_readdir(ap_dir_t *)
+ * Rewind the directory to the first entry.
+ * arg 1) the directory descriptor to rewind.
+ */
ap_status_t ap_rewinddir(struct dir_t *thedir)
{
rewinddir(thedir->dirstruct);
return APR_SUCCESS;
}
+/* ***APRDOC********************************************************
+ * ap_status_t ap_make_dir(ap_context_t *, const char *, ap_fileperms_t)
+ * Create a new directory on the file system.
+ * arg 1) the context to use.
+ * arg 2) the path for the directory to be created. (use / on all systems)
+ * arg 3) Permissions for the new direcoty.
+ */
ap_status_t ap_make_dir(ap_context_t *cont, const char *path, ap_fileperms_t
perm)
{
mode_t mode = get_fileperms(perm);
@@ -128,6 +157,12 @@
}
}
+/* ***APRDOC********************************************************
+ * ap_status_t ap_remove_dir(ap_context_t *, const char *)
+ * Remove directory from the file system.
+ * arg 1) the context to use.
+ * arg 2) the path for the directory to be removed. (use / on all systems)
+ */
ap_status_t ap_remove_dir(ap_context_t *cont, const char *path)
{
if (rmdir(path) == 0) {
@@ -138,6 +173,12 @@
}
}
+/* ***APRDOC********************************************************
+ * ap_status_t ap_dir_entry_size(ap_dir_t *, ap_ssize_t *)
+ * Get the size of the current directory entry.
+ * arg 1) the currently open directory.
+ * arg 2) the size of the directory entry.
+ */
ap_status_t ap_dir_entry_size(struct dir_t *thedir, ap_ssize_t *size)
{
struct stat filestat;
@@ -158,6 +199,12 @@
return APR_SUCCESS;
}
+/* ***APRDOC********************************************************
+ * ap_status_t ap_dir_entry_mtime(ap_dir_t *, time_t *)
+ * Get the last modified time of the current directory entry.
+ * arg 1) the currently open directory.
+ * arg 2) the last modified time of the directory entry.
+ */
ap_status_t ap_dir_entry_mtime(struct dir_t *thedir, time_t *time)
{
struct stat filestat;
@@ -179,6 +226,12 @@
return APR_SUCCESS;
}
+/* ***APRDOC********************************************************
+ * ap_status_t ap_dir_entry_ftype(ap_dir_t *, ap_filetype_e *)
+ * Get the file type of the current directory entry.
+ * arg 1) the currently open directory.
+ * arg 2) the file type of the directory entry.
+ */
ap_status_t ap_dir_entry_ftype(struct dir_t *thedir, ap_filetype_e *type)
{
struct stat filestat;
@@ -213,6 +266,12 @@
return APR_SUCCESS;
}
+/* ***APRDOC********************************************************
+ * ap_status_t ap_dir_entry_filename(ap_dir_t *, char **)
+ * Get the file name of the current directory entry.
+ * arg 1) the currently open directory.
+ * arg 2) the file name of the directory entry.
+ */
ap_status_t ap_get_dir_filename(struct dir_t *thedir, char **new)
{
(*new) = ap_pstrdup(thedir->cntxt->pool, thedir->entry->d_name);
1.11 +36 -0 apache-apr/apr/file_io/unix/fileacc.c
Index: fileacc.c
===================================================================
RCS file: /home/cvs/apache-apr/apr/file_io/unix/fileacc.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- fileacc.c 1999/05/25 03:14:14 1.10
+++ fileacc.c 1999/06/01 12:05:42 1.11
@@ -63,6 +63,12 @@
/* A file to put ALL of the accessor functions for struct file_t types. */
+/* ***APRDOC********************************************************
+ * ap_status_t ap_get_filename(ap_file_t *, char **)
+ * return the file name of the current file.
+ * arg 1) The currently open file.
+ * arg 2) The path of the file.
+ */
ap_status_t ap_get_filename(struct file_t *thefile, char **new)
{
if (thefile != NULL) {
@@ -103,6 +109,12 @@
return rv;
}
+/* ***APRDOC********************************************************
+ * ap_status_t ap_get_filesize(ap_file_t *, ap_ssize_t *)
+ * Return the size of the current file.
+ * arg 1) The currently open file.
+ * arg 2) The size of the file.
+ */
ap_status_t ap_get_filesize(struct file_t *file, ap_ssize_t *size)
{
if (file != NULL) {
@@ -115,6 +127,12 @@
}
}
+/* ***APRDOC********************************************************
+ * ap_status_t ap_get_fileperms(ap_file_t *, ap_fileperms_t *)
+ * Return the permissions of the current file.
+ * arg 1) The currently open file.
+ * arg 2) The permissions of the file.
+ */
ap_status_t ap_get_fileperms(struct file_t *file, ap_fileperms_t *perm)
{
if (file != NULL) {
@@ -127,6 +145,12 @@
}
}
+/* ***APRDOC********************************************************
+ * ap_status_t ap_get_fileatime(ap_file_t *, time_t *)
+ * Return the last access time of the current file.
+ * arg 1) The currently open file.
+ * arg 2) The last access time of the file.
+ */
ap_status_t ap_get_fileatime(struct file_t *file, time_t *time)
{
if (file != NULL) {
@@ -139,6 +163,12 @@
}
}
+/* ***APRDOC********************************************************
+ * ap_status_t ap_get_filectime(ap_file_t *, time_t *)
+ * Return the time of the last change to the current file.
+ * arg 1) The currently open file.
+ * arg 2) The last change time of the file.
+ */
ap_status_t ap_get_filectime(struct file_t *file, time_t *time)
{
if (file != NULL) {
@@ -151,6 +181,12 @@
}
}
+/* ***APRDOC********************************************************
+ * ap_status_t ap_get_filemtime(ap_file_t *, time_t *)
+ * Return the last modified time of the current file.
+ * arg 1) The currently open file.
+ * arg 2) The last modified time of the file.
+ */
ap_status_t ap_get_filemtime(struct file_t *file, time_t *time)
{
if (file != NULL) {
1.14 +6 -0 apache-apr/apr/file_io/unix/filedup.c
Index: filedup.c
===================================================================
RCS file: /home/cvs/apache-apr/apr/file_io/unix/filedup.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- filedup.c 1999/05/25 03:14:14 1.13
+++ filedup.c 1999/06/01 12:05:42 1.14
@@ -59,6 +59,12 @@
#include "apr_lib.h"
#include <string.h>
+/* ***APRDOC********************************************************
+ * ap_status_t ap_dupfile(ap_file_t *, ap_file_t **)
+ * duplicate the specified file descriptor.
+ * arg 1) The file to duplicate.
+ * arg 2) The structure to duplicate into.
+ */
ap_status_t ap_dupfile(struct file_t *old_file, struct file_t **new_file)
{
(*new_file) = (struct file_t *)ap_palloc(old_file->cntxt->pool,
1.7 +8 -22 apache-apr/apr/file_io/unix/filestat.c
Index: filestat.c
===================================================================
RCS file: /home/cvs/apache-apr/apr/file_io/unix/filestat.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- filestat.c 1999/05/24 17:28:16 1.6
+++ filestat.c 1999/06/01 12:05:42 1.7
@@ -58,6 +58,14 @@
#include "apr_general.h"
#include "apr_errno.h"
+/* ***APRDOC********************************************************
+ * ap_status_t ap_remove_file(ap_context_t *, char *)
+ * delete the specified file.
+ * arg 1) The context to use.
+ * arg 2) The full path to the file (using / on all systems)
+ * NOTE: If the file is open, it won't be removed until all instances are
+ * closed.
+ */
ap_status_t ap_getfileinfo(struct file_t *thefile)
{
struct stat info;
@@ -77,26 +85,4 @@
return APR_ENOSTAT;
}
}
-
-ap_status_t ap_updatefileinfo(struct file_t *thefile)
-{
- struct stat info;
- int rv = fstat(thefile->filedes, &info);
-
- if (rv == 0) {
- thefile->protection = info.st_mode;
- thefile->user = info.st_uid;
- thefile->group = info.st_gid;
- thefile->size = info.st_size;
- thefile->atime = info.st_atime;
- thefile->mtime = info.st_mtime;
- thefile->ctime = info.st_ctime;
- return APR_SUCCESS;
- }
- else {
- return APR_ENOSTAT;
- }
-}
-
-
1.26 +31 -0 apache-apr/apr/file_io/unix/open.c
Index: open.c
===================================================================
RCS file: /home/cvs/apache-apr/apr/file_io/unix/open.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- open.c 1999/05/27 19:02:25 1.25
+++ open.c 1999/06/01 12:05:42 1.26
@@ -74,6 +74,24 @@
}
}
+/* ***APRDOC********************************************************
+ * ap_status_t ap_open(ap_context_t *, char *, ap_int32,
+ * ap_fileperms, ap_file_t **)
+ * Open the specified file.
+ * arg 1) The context to use.
+ * arg 2) The full path to the file (using / on all systems)
+ * arg 3) Or'ed value of:
+ * APR_READ open for reading
+ * APR_WRITE open for writing
+ * APR_CREATE create the file if not there
+ * APR_APPEND file ptr is set to end prior to all writes
+ * APR_TRUNCATE set length to zero if file exists
+ * APR_BINARY not a test file
+ * APR_BUFFERED buffer the data. Default is non-buffered
+ * APR_EXCL return error if APR_CREATE and file exists
+ * arg 4) Access permissions for file.
+ * arg 5) The opened file descriptor.
+ */
ap_status_t ap_open(ap_context_t *cont, char *fname, ap_int32_t flag,
ap_fileperms_t perm, struct file_t **new)
{
int oflags = 0;
@@ -138,6 +156,11 @@
}
}
+/* ***APRDOC********************************************************
+ * ap_status_t ap_close(ap_file_t *)
+ * Close the specified file.
+ * arg 1) The file descriptor to close.
+ */
ap_status_t ap_close(struct file_t *file)
{
ap_status_t rv;
@@ -149,6 +172,14 @@
return rv;
}
+/* ***APRDOC********************************************************
+ * ap_status_t ap_remove_file(ap_context_t *, char *)
+ * delete the specified file.
+ * arg 1) The context to use.
+ * arg 2) The full path to the file (using / on all systems)
+ * NOTE: If the file is open, it won't be removed until all instances are
+ * closed.
+ */
ap_status_t ap_remove_file(ap_context_t *cont, char *path)
{
if (unlink(path) == 0) {