Lines Matching refs:file

2  * contributor license agreements.  See the NOTICE file distributed with
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
33 * Flow to Find the .data file:
37 * Read in <hash>.header file (may contain Format #1 or Format #2)
68 apr_file_t *file);
110 static apr_status_t mkdir_structure(disk_cache_conf *conf, const char *file, apr_pool_t *pool)
115 for (p = (char*)file + conf->cache_root_len + 1;;) {
121 rv = apr_dir_make(file,
161 static apr_status_t file_cache_el_final(disk_cache_conf *conf, disk_cache_file_t *file,
166 /* This assumes that the tempfiles are on the same file system
167 * as the cache_root. If not, then we need a file copy/move
171 /* move the file over */
172 if (file->tempfd) {
174 rv = safe_file_rename(conf, file->tempfile, file->file, file->pool);
177 "rename tempfile to file failed:"
178 " %s -> %s", file->tempfile, file->file);
179 apr_file_remove(file->tempfile, file->pool);
182 file->tempfd = NULL;
189 disk_cache_file_t *file = (disk_cache_file_t *)dummy;
191 /* clean up the temporary file */
192 if (file->tempfd) {
193 apr_file_remove(file->tempfile, file->pool);
194 file->tempfd = NULL;
196 file->tempfile = NULL;
197 file->pool = NULL;
202 static apr_status_t file_cache_create(disk_cache_conf *conf, disk_cache_file_t *file,
205 file->pool = pool;
206 file->tempfile = apr_pstrcat(pool, conf->cache_root, AP_TEMPFILE, NULL);
208 apr_pool_cleanup_register(pool, file, file_cache_temp_cleanup, apr_pool_cleanup_null);
214 * file for an ap_cache_el, this state information will be read
224 /* read the data from the cache file */
394 dobj->data.file = data_file(r->pool, conf, dobj, key);
395 dobj->hdrs.file = header_file(r->pool, conf, dobj, key);
396 dobj->vary.file = header_file(r->pool, conf, dobj, key);
440 /* Open the headers file */
447 dobj->vary.file = header_file(r->pool, conf, dobj, key);
449 rc = apr_file_open(&dobj->vary.fd, dobj->vary.file, flags, 0, r->pool);
454 /* read the format from the cache file */
469 "Cannot parse vary header file: %s",
470 dobj->vary.file);
479 dobj->prefix = dobj->vary.file;
480 dobj->hdrs.file = header_file(r->pool, conf, dobj, nkey);
483 rc = apr_file_open(&dobj->hdrs.fd, dobj->hdrs.file, flags, 0, r->pool);
491 dobj->vary.file, format);
501 dobj->hdrs.file = dobj->vary.file;
503 /* This wasn't a Vary Format file, so we must seek to the
504 * start of the file again, so that later reads work.
521 dobj->data.file = data_file(r->pool, conf, dobj, nkey);
527 "Cannot read header file %s", dobj->hdrs.file);
537 dobj->hdrs.file);
542 /* Open the data file */
552 rc = apr_file_open(&dobj->data.fd, dobj->data.file, flags, 0, r->pool);
555 "Cannot open data file %s", dobj->data.file);
566 /* Atomic check - does the body file belong to the header file? */
600 static void close_disk_cache_fd(disk_cache_file_t *file)
602 if (file->fd != NULL) {
603 apr_file_close(file->fd);
604 file->fd = NULL;
606 if (file->tempfd != NULL) {
607 apr_file_close(file->tempfd);
608 file->tempfd = NULL;
636 /* Delete headers file */
637 if (dobj->hdrs.file) {
639 "Deleting %s from cache.", dobj->hdrs.file);
641 rc = apr_file_remove(dobj->hdrs.file, r->pool);
647 "Failed to delete headers file %s from cache.",
648 dobj->hdrs.file);
653 /* Delete data file */
654 if (dobj->data.file) {
656 "Deleting %s from cache.", dobj->data.file);
658 rc = apr_file_remove(dobj->data.file, r->pool);
664 "Failed to delete data file %s from cache.",
665 dobj->data.file);
674 str_to_copy = dobj->hdrs.file ? dobj->hdrs.file : dobj->data.file;
688 * Note: due to the way we constructed the file names in
712 apr_file_t *file)
719 rv = apr_file_gets(w, MAX_STRING_LEN - 1, file);
776 apr_table_t *table, apr_file_t *file)
786 rv = apr_file_gets(w, MAX_STRING_LEN - 1, file);
859 * Returns NULL on file error
980 dobj->hdrs.file = dobj->prefix;
984 rv = mkdir_structure(conf, dobj->hdrs.file, r->pool);
992 "could not create vary file %s",
1001 "could not write to vary file %s",
1013 "could not write to vary file %s",
1028 "could not close vary file %s",
1035 dobj->prefix = dobj->hdrs.file;
1037 dobj->data.file = data_file(r->pool, conf, dobj, tmp);
1038 dobj->hdrs.file = header_file(r->pool, conf, dobj, tmp);
1049 "could not create header file %s",
1079 "could not write info to header file %s",
1090 "could not write out-headers to header file %s",
1104 "could not write in-headers to header file %s",
1115 "could not close header file %s",
1188 /* Remove the intermediate cache file and return non-APR_SUCCESS */
1200 /* Attempt to create the data file at the last possible moment, if
1201 * the body is empty, we don't write a file at all, and save an inode.
1228 APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(00731) "Error when writing cache file for URL %s", h->cache_obj->key);
1229 /* Remove the intermediate cache file and return non-APR_SUCCESS */
1238 /* Remove the intermediate cache file and return non-APR_SUCCESS */
1262 /* Was this the final bucket? If yes, close the temp file and perform
1283 /* Remove the intermediate cache file and return non-APR_SUCCESS */
1291 /* Remove the intermediate cache file and return non-APR_SUCCESS */
1300 /* Remove the intermediate cache file and return non-APR_SUCCESS */
1335 else if (dobj->data.file){
1336 rv = apr_file_remove(dobj->data.file, dobj->data.pool);
1473 return "CacheMinFileSize argument must be a non-negative integer representing the min size of a file to cache in bytes.";
1487 return "CacheMaxFileSize argument must be a non-negative integer representing the max size of a file to cache in bytes.";
1532 "The minimum file size to cache a document"),
1534 "The maximum file size to cache a document"),