access.c revision 302408
1/* 2 * access.c: shared code to manipulate svn_fs_access_t objects 3 * 4 * ==================================================================== 5 * Licensed to the Apache Software Foundation (ASF) under one 6 * or more contributor license agreements. See the NOTICE file 7 * distributed with this work for additional information 8 * regarding copyright ownership. The ASF licenses this file 9 * to you under the Apache License, Version 2.0 (the 10 * "License"); you may not use this file except in compliance 11 * with the License. You may obtain a copy of the License at 12 * 13 * http://www.apache.org/licenses/LICENSE-2.0 14 * 15 * Unless required by applicable law or agreed to in writing, 16 * software distributed under the License is distributed on an 17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18 * KIND, either express or implied. See the License for the 19 * specific language governing permissions and limitations 20 * under the License. 21 * ==================================================================== 22 */ 23 24 25#include <apr_hash.h> 26 27#include "svn_hash.h" 28#include "svn_types.h" 29#include "svn_pools.h" 30#include "svn_fs.h" 31#include "private/svn_fs_private.h" 32 33#include "fs-loader.h" 34 35 36 37svn_error_t * 38svn_fs_create_access(svn_fs_access_t **access_ctx, 39 const char *username, 40 apr_pool_t *pool) 41{ 42 svn_fs_access_t *ac; 43 44 SVN_ERR_ASSERT(username != NULL); 45 46 ac = apr_pcalloc(pool, sizeof(*ac)); 47 ac->username = apr_pstrdup(pool, username); 48 ac->lock_tokens = apr_hash_make(pool); 49 *access_ctx = ac; 50 51 return SVN_NO_ERROR; 52} 53 54 55svn_error_t * 56svn_fs_set_access(svn_fs_t *fs, 57 svn_fs_access_t *access_ctx) 58{ 59 fs->access_ctx = access_ctx; 60 61 return SVN_NO_ERROR; 62} 63 64 65svn_error_t * 66svn_fs_get_access(svn_fs_access_t **access_ctx, 67 svn_fs_t *fs) 68{ 69 *access_ctx = fs->access_ctx; 70 71 return SVN_NO_ERROR; 72} 73 74 75svn_error_t * 76svn_fs_access_get_username(const char **username, 77 svn_fs_access_t *access_ctx) 78{ 79 *username = access_ctx->username; 80 81 return SVN_NO_ERROR; 82} 83 84 85svn_error_t * 86svn_fs_access_add_lock_token2(svn_fs_access_t *access_ctx, 87 const char *path, 88 const char *token) 89{ 90 svn_hash_sets(access_ctx->lock_tokens, token, path); 91 return SVN_NO_ERROR; 92} 93 94apr_hash_t * 95svn_fs__access_get_lock_tokens(svn_fs_access_t *access_ctx) 96{ 97 return access_ctx->lock_tokens; 98} 99