wrowe 01/01/20 13:38:03
Modified: . CHANGES STATUS
include apr_file_info.h apr_file_io.h
Log:
The APR_FINFO_wanted declaration changes for apr_stat/lstat/getfileinfo.
Revision Changes Path
1.44 +5 -0 apr/CHANGES
Index: CHANGES
===================================================================
RCS file: /home/cvs/apr/CHANGES,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- CHANGES 2001/01/19 20:44:45 1.43
+++ CHANGES 2001/01/20 21:38:03 1.44
@@ -1,5 +1,10 @@
Changes with APR b1
+ *) Introduce the wanted flag argument to the apr_stat/lstat/getfileinfo
+ family of functions. This change allows the user to determine what
+ platform-specific file information is retrieved, to optimize both
+ portability and performance. [William Rowe]
+
*) Fix make depend. [Ryan Bloom]
*) All dso implementations now register a cleanup to unload the DSO
1.26 +6 -1 apr/STATUS
Index: STATUS
===================================================================
RCS file: /home/cvs/apr/STATUS,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- STATUS 2001/01/19 03:13:00 1.25
+++ STATUS 2001/01/20 21:38:03 1.26
@@ -1,5 +1,5 @@
APACHE PORTABLE RUNTIME (APR) LIBRARY STATUS:
-*-text-*-
-Last modified at [$Date: 2001/01/19 03:13:00 $]
+Last modified at [$Date: 2001/01/20 21:38:03 $]
Release:
@@ -23,6 +23,9 @@
RELEASE NON-SHOWSTOPPERS BUT WOULD BE REAL NICE TO WRAP THESE UP:
+ * Unix, OS2 apr_stat/lstat/getfileinfo were very fast hacks. These
+ need to be fleshed out.
+
* SysV semaphore support isn't usable by Apache when started as
root because we don't have a way to allow the semaphore to be
used by the configured User and Group. Current work-around:
@@ -38,6 +41,8 @@
something similar) to direct ap_create_process to create the
process suspended. We also need a call to wake up the suspended
process This may not be able to be implemented everywhere though.
+ Status: OtherBill asks, why? What is the benefit, how is it
+ portably implemented?
* Replace tables with a proper opaque ADT that has pluggable
implementations (including something like the existing data type,
1.2 +52 -9 apr/include/apr_file_info.h
Index: apr_file_info.h
===================================================================
RCS file: /home/cvs/apr/include/apr_file_info.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- apr_file_info.h 2001/01/19 17:29:44 1.1
+++ apr_file_info.h 2001/01/20 21:38:03 1.2
@@ -136,14 +136,43 @@
typedef struct apr_finfo_t apr_finfo_t;
+#define APR_FINFO_LINK 0x00000001
+#define APR_FINFO_MTIME 0x00000010
+#define APR_FINFO_CTIME 0x00000020
+#define APR_FINFO_ATIME 0x00000040
+#define APR_FINFO_SIZE 0x00000100
+#define APR_FINFO_ASIZE 0x00000200
+#define APR_FINFO_CSIZE 0x00000400
+#define APR_FINFO_DEV 0x00001000
+#define APR_FINFO_INODE 0x00002000
+#define APR_FINFO_TYPE 0x00008000
+#define APR_FINFO_USER 0x00010000
+#define APR_FINFO_GROUP 0x00020000
+#define APR_FINFO_UPROT 0x00100000
+#define APR_FINFO_GPROT 0x00200000
+#define APR_FINFO_WPROT 0x00400000
+#define APR_FINFO_ICASE 0x01000000 /* if dev is case insensitive */
+#define APR_FINFO_FCASE 0x02000000 /* filename in proper case */
+
+#define APR_FINFO_MIN 0x00008170 /* minimal: type, dates and size */
+#define APR_FINFO_IDENT 0x00003000 /* dev and inode */
+#define APR_FINFO_OWNER 0x00030000 /* user and group */
+#define APR_FINFO_PROT 0x00700000 /* all protections */
+#define APR_FINFO_NORM 0x0073b170 /* the expected unix results */
+
+typedef struct apr_file_t apr_file_t;
+
/**
* The file information structure. This is analogous to the POSIX
* stat structure.
*/
struct apr_finfo_t {
- /** The access permissions of the file. Currently this mimics Unix
- * access rights.
- */
+ /** Allocates memory and closes lingering handles in the specified pool
*/
+ apr_pool_t *cntxt;
+ /** The bitmask describing valid fields of this apr_finfo_t structure
+ * including all available 'wanted' fields and potentially more */
+ apr_int32_t valid;
+ /** The access permissions of the file. Mimics Unix access rights. */
apr_fileperms_t protection;
/** The type of file. One of APR_NOFILE, APR_REG, APR_DIR, APR_CHR,
* APR_BLK, APR_PIPE, APR_LNK, APR_SOCK
@@ -153,18 +182,28 @@
apr_uid_t user;
/** The group id that owns the file */
apr_gid_t group;
- /** The inode of the file. (Not portable?) */
+ /** The inode of the file. */
apr_ino_t inode;
- /** The id of the device the file is on. (Not portable?) */
+ /** The id of the device the file is on. */
apr_dev_t device;
/** The size of the file */
apr_off_t size;
+ /** The space allocated for the file */
+ apr_off_t asize;
+ /** The storage size consumed by the file */
+ apr_off_t csize;
/** The time the file was last accessed */
apr_time_t atime;
/** The time the file was last modified */
apr_time_t mtime;
/** The time the file was last changed */
apr_time_t ctime;
+ /** The full pathname of the file */
+ char *fname;
+ /** The file's name alone, in filesystem case */
+ char *fcase;
+ /** The file's handle, if accessed (can be submitted to apr_duphandle) */
+ apr_file_t *filehand;
};
/**
@@ -173,11 +212,12 @@
* @param finfo Where to store the information about the file, which is
* never touched if the call fails.
* @param fname The name of the file to stat.
+ * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_
values
* @param cont the pool to use to allocate the new file.
- * @deffunc apr_status_t apr_stat(apr_finfo_t *finfo, const char *fname,
apr_pool_t *cont)
+ * @deffunc apr_status_t apr_stat(apr_finfo_t *finfo, const char *fname,
apr_int32_t wanted, apr_pool_t *cont)
*/
APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname,
- apr_pool_t *cont);
+ apr_int32_t wanted, apr_pool_t *cont);
/**
* get the specified file's stats. The file is specified by filename,
@@ -186,11 +226,14 @@
* @param finfo Where to store the information about the file, which is
* never touched if the call fails.
* @param fname The name of the file to stat.
+ * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_
values
* @param cont the pool to use to allocate the new file.
- * @deffunc apr_status_t apr_lstat(apr_finfo_t *finfo, const char *fname,
apr_pool_t *cont)
+ * @deffunc apr_status_t apr_lstat(apr_finfo_t *finfo, const char *fname,
apr_int32_t wanted, apr_pool_t *cont)
+ * @tip This function is depreciated, it's equivilant to calling apr_stat
with
+ * the wanted flag value APR_FINFO_LINK
*/
APR_DECLARE(apr_status_t) apr_lstat(apr_finfo_t *finfo, const char *fname,
- apr_pool_t *cont);
+ apr_int32_t wanted, apr_pool_t *cont);
/**
* Open the specified directory.
1.89 +6 -2 apr/include/apr_file_io.h
Index: apr_file_io.h
===================================================================
RCS file: /home/cvs/apr/include/apr_file_io.h,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -r1.88 -r1.89
--- apr_file_io.h 2001/01/20 11:58:21 1.88
+++ apr_file_io.h 2001/01/20 21:38:03 1.89
@@ -84,6 +84,8 @@
exists. */
#define APR_BUFFERED 128 /* Open the file for buffered I/O */
#define APR_DELONCLOSE 256 /* Delete the file after close */
+#define APR_XTHREAD 512 /* Platform dependent tag to open the
file
+ for use across multiple threads */
/* flags for apr_seek */
#define APR_SET SEEK_SET
@@ -517,10 +519,12 @@
/**
* get the specified file's stats.
* @param finfo Where to store the information about the file.
+ * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_
values
* @param thefile The file to get information about.
- * @deffunc apr_status_t apr_getfileinfo(apr_finfo_t *finfo, apr_file_t
*thefile)
+ * @deffunc apr_status_t apr_getfileinfo(apr_finfo_t *finfo, apr_int32_t
wanted, apr_file_t *thefile)
*/
-APR_DECLARE(apr_status_t) apr_getfileinfo(apr_finfo_t *finfo,
+APR_DECLARE(apr_status_t) apr_getfileinfo(apr_finfo_t *finfo,
+ apr_int32_t wanted,
apr_file_t *thefile);
#ifdef __cplusplus