/* Copyright 2000-2004 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "apr_strings.h" #include "apr_arch_file_io.h" /* A file to put ALL of the accessor functions for apr_file_t types. */ APR_DECLARE(apr_status_t) apr_file_name_get(const char **fname, apr_file_t *thefile) 1 { 1 *fname = thefile->fname; 1 return APR_SUCCESS; } APR_DECLARE(apr_int32_t) apr_file_flags_get(apr_file_t *f) ###### { ###### return f->flags; } #if !defined(OS2) && !defined(WIN32) mode_t apr_unix_perms2mode(apr_fileperms_t perms) 40 { 40 mode_t mode = 0; 40 if (perms & APR_UREAD) 35 mode |= S_IRUSR; 40 if (perms & APR_UWRITE) 34 mode |= S_IWUSR; 40 if (perms & APR_UEXECUTE) 10 mode |= S_IXUSR; 40 if (perms & APR_GREAD) 23 mode |= S_IRGRP; 40 if (perms & APR_GWRITE) 4 mode |= S_IWGRP; 40 if (perms & APR_GEXECUTE) 2 mode |= S_IXGRP; 40 if (perms & APR_WREAD) 4 mode |= S_IROTH; 40 if (perms & APR_WWRITE) 2 mode |= S_IWOTH; 40 if (perms & APR_WEXECUTE) 2 mode |= S_IXOTH; 40 return mode; } apr_fileperms_t apr_unix_mode2perms(mode_t mode) 36 { 36 apr_fileperms_t perms = 0; 36 if (mode & S_IRUSR) 36 perms |= APR_UREAD; 36 if (mode & S_IWUSR) 36 perms |= APR_UWRITE; 36 if (mode & S_IXUSR) 6 perms |= APR_UEXECUTE; 36 if (mode & S_IRGRP) 31 perms |= APR_GREAD; 36 if (mode & S_IWGRP) 11 perms |= APR_GWRITE; 36 if (mode & S_IXGRP) 2 perms |= APR_GEXECUTE; 36 if (mode & S_IROTH) 11 perms |= APR_WREAD; 36 if (mode & S_IWOTH) ###### perms |= APR_WWRITE; 36 if (mode & S_IXOTH) 2 perms |= APR_WEXECUTE; 36 return perms; } #endif APR_DECLARE(apr_status_t) apr_file_data_get(void **data, const char *key, apr_file_t *file) 2 { 2 return apr_pool_userdata_get(data, key, file->pool); } APR_DECLARE(apr_status_t) apr_file_data_set(apr_file_t *file, void *data, const char *key, apr_status_t (*cleanup)(void *)) 2 { 2 return apr_pool_userdata_set(data, key, cleanup, file->pool); }