Lines Matching defs:resource
44 /* context needed to identify a resource */
47 const char *pathname; /* full pathname to resource */
78 /* CALLBACK: this is a secondary resource managed specially for us */
222 static request_rec *dav_fs_get_request_rec(const dav_resource *resource)
224 return resource->info->r;
227 apr_pool_t *dav_fs_pool(const dav_resource *resource)
229 return resource->info->pool;
232 const char *dav_fs_pathname(const dav_resource *resource)
234 return resource->info->pathname;
238 const dav_resource *resource,
242 dav_resource_private *ctx = resource->info;
244 if (resource->collection) {
573 /* Get the corresponding state files for each resource */
612 static dav_error *dav_fs_deleteset(apr_pool_t *p, const dav_resource *resource)
621 /* Get directory, filename, and state-file names for the resource */
623 (void) dav_fs_dir_file_name(resource, &dirpath, &fname);
674 dav_resource *resource;
681 /* Create private resource context descriptor */
712 /* Create resource descriptor */
713 resource = apr_pcalloc(r->pool, sizeof(*resource));
714 resource->type = DAV_RESOURCE_TYPE_REGULAR;
715 resource->info = ctx;
716 resource->hooks = &dav_hooks_repository_fs;
717 resource->pool = r->pool;
723 resource->uri = s;
726 resource->uri = r->uri;
730 resource->exists = 1;
731 resource->collection = r->finfo.filetype == APR_DIR;
733 /* unused info in the URL will indicate a null resource */
736 if (resource->collection) {
741 ** This URL/filename represents a locknull resource or
744 resource->exists = 0;
745 resource->collection = 0;
752 ** be in path_info. The resource is simply an error: it
753 ** can't be a null or a locknull resource.
757 "components. The resource could not "
762 if (!resource->exists) {
768 *result_resource = resource;
772 static dav_error * dav_fs_get_parent_resource(const dav_resource *resource,
775 dav_resource_private *ctx = resource->info;
784 if (strcmp(resource->uri, "/") == 0) {
789 /* If given resource is root, then there is no parent.
804 /* Create private resource context descriptor */
819 parent_resource->pool = resource->pool;
821 if (resource->uri != NULL) {
822 char *uri = ap_make_dirstr_parent(ctx->pool, resource->uri);
907 static dav_error * dav_fs_open_stream(const dav_resource *resource,
911 apr_pool_t *p = resource->info->pool;
930 ds->pathname = resource->info->pathname;
959 "An error occurred while opening a resource.");
985 "back) the resource "
1012 "this resource.");
1018 "resource.");
1034 "resource.");
1046 const dav_resource *resource)
1049 if (!resource->exists)
1053 ap_update_mtime(r, resource->info->finfo.mtime);
1055 /* ### note that these use r->filename rather than <resource> */
1063 ap_set_content_length(r, resource->info->finfo.size);
1071 static dav_error * dav_fs_deliver(const dav_resource *resource,
1074 apr_pool_t *pool = resource->pool;
1080 /* Check resource type */
1081 if (resource->type != DAV_RESOURCE_TYPE_REGULAR
1082 && resource->type != DAV_RESOURCE_TYPE_VERSION
1083 && resource->type != DAV_RESOURCE_TYPE_WORKING) {
1085 "Cannot GET this type of resource.");
1087 if (resource->collection) {
1093 if ((status = apr_file_open(&fd, resource->info->pathname,
1102 apr_brigade_insert_file(bb, fd, 0, resource->info->finfo.size, pool);
1118 static dav_error * dav_fs_create_collection(dav_resource *resource)
1120 dav_resource_private *ctx = resource->info;
1140 /* update resource state to show it exists as a collection */
1141 resource->exists = 1;
1142 resource->collection = 1;
1152 dav_resource_private *srcinfo = wres->resource->info;
1156 if (wres->resource->collection) {
1198 || !dav_fs_is_same_resource(wres->resource, ctx->root))) {
1294 /* update state of destination resource to show it exists */
1332 /* update resource states */
1348 "Could not rename resource.");
1351 /* Rename did work. Update resource states and move properties as well */
1363 /* error occurred during properties move; try to put resource back */
1369 "The resource was moved, but a failure "
1371 "properties. The resource could not be "
1377 /* update resource states again */
1383 /* resource moved back, but properties may be inconsistent */
1386 "The resource was moved, but a failure "
1388 "The resource was moved back to its original "
1397 dav_resource_private *info = wres->resource->info;
1399 /* do not attempt to remove a null resource,
1402 if (wres->resource->exists &&
1403 (!wres->resource->collection || calltype == DAV_CALLTYPE_POSTFIX)) {
1404 /* try to remove the resource */
1407 result = wres->resource->collection
1413 ** Note that we add it for the root resource, too. It is quite
1429 static dav_error * dav_fs_remove_resource(dav_resource *resource,
1433 dav_resource_private *info = resource->info;
1440 if (resource->collection) {
1450 params.root = resource;
1465 /* no errors... update resource state */
1466 resource->exists = 0;
1467 resource->collection = 0;
1478 /* update resource state */
1479 resource->exists = 0;
1480 resource->collection = 0;
1483 return dav_fs_deleteset(info->pool, resource);
1594 /* set up the URI for the current resource */
1678 ** resource is not a collection.
1694 /* set up the URI for the current resource */
1699 ** resource, query the lock database to force removal
1702 ** the locknull resource was already included in the
1717 ### reported. Therefore, a null resource would be returned
1837 /* the current resource's URI is stored in the uri_buf buffer */
1840 /* point the callback's resource at our structure */
1841 fsctx.wres.resource = &fsctx.res1;
1860 static const char *dav_fs_getetag(const dav_resource *resource)
1862 dav_resource_private *ctx = resource->info;
1865 if (!resource->exists)
1908 static dav_prop_insert dav_fs_insert_prop(const dav_resource *resource,
1914 apr_pool_t *p = resource->info->pool;
1923 ** None of FS provider properties are defined if the resource does not
1930 if (!resource->exists)
1941 resource->info->finfo.ctime,
1948 if (resource->collection)
1951 apr_snprintf(buf, sizeof(buf), "%" APR_OFF_T_FMT, resource->info->finfo.size);
1956 value = dav_fs_getetag(resource);
1961 resource->info->finfo.mtime,
1968 if (resource->collection)
1972 if (!(resource->info->finfo.valid & APR_FINFO_UPROT))
1976 if (resource->info->finfo.protection & APR_UEXECUTE)
2016 static int dav_fs_is_writable(const dav_resource *resource, int propid)
2023 if (propid == DAV_PROPID_FS_executable && !resource->collection)
2031 static dav_error *dav_fs_patch_validate(const dav_resource *resource,
2048 return dav_new_error(resource->info->pool, HTTP_CONFLICT, 0, 0,
2063 return dav_new_error(resource->info->pool, HTTP_CONFLICT, 0, 0,
2078 return dav_new_error(resource->info->pool, HTTP_CONFLICT, 0, 0,
2089 return dav_new_error(resource->info->pool, HTTP_CONFLICT, 0, 0,
2096 static dav_error *dav_fs_patch_exec(const dav_resource *resource,
2103 apr_fileperms_t perms = resource->info->finfo.protection;
2118 if ((status = apr_file_perms_set(resource->info->pathname, perms))
2120 return dav_new_error(resource->info->pool,
2123 "target resource.");
2126 /* update the resource and set up the rollback context */
2127 resource->info->finfo.protection = perms;
2133 static void dav_fs_patch_commit(const dav_resource *resource,
2141 static dav_error *dav_fs_patch_rollback(const dav_resource *resource,
2146 apr_fileperms_t perms = resource->info->finfo.protection & ~APR_UEXECUTE;
2156 if ((status = apr_file_perms_set(resource->info->pathname, perms))
2158 return dav_new_error(resource->info->pool,
2160 "After a failure occurred, the resource's "
2164 /* restore the resource's state */
2165 resource->info->finfo.protection = perms;
2202 int dav_fs_find_liveprop(const dav_resource *resource,
2206 /* don't try to find any liveprops if this isn't "our" resource */
2207 if (resource->hooks != &dav_hooks_repository_fs)
2212 void dav_fs_insert_all_liveprops(request_rec *r, const dav_resource *resource,
2215 /* don't insert any liveprops if this isn't "our" resource */
2216 if (resource->hooks != &dav_hooks_repository_fs)
2219 if (!resource->exists) {
2220 /* a lock-null resource */
2229 (void) dav_fs_insert_prop(resource, DAV_PROPID_creationdate,
2231 (void) dav_fs_insert_prop(resource, DAV_PROPID_getcontentlength,
2233 (void) dav_fs_insert_prop(resource, DAV_PROPID_getlastmodified,
2235 (void) dav_fs_insert_prop(resource, DAV_PROPID_getetag,
2240 (void) dav_fs_insert_prop(resource, DAV_PROPID_FS_executable,