M4OSA_FileCommon_priv.h revision aa382f3637a68361989d5b70e3184bddcc472d3d
1/* 2 * Copyright (C) 2004-2011 NXP Software 3 * Copyright (C) 2011 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17/** 18 ************************************************************************ 19 * @file M4OSA_FileCommon_priv.h 20 * @ingroup OSAL 21 * @brief File common private for Android 22 * @note This file declares functions and types used by both the file 23 * writer and file reader. 24 ************************************************************************ 25*/ 26 27#ifndef M4OSA_FILECOMMON_PRIV_H 28#define M4OSA_FILECOMMON_PRIV_H 29 30 31#include "M4OSA_FileCommon.h" 32#include <stdio.h> 33 34#define M4OSA_isAccessModeActived(compound_mode_access,elementary_mode_access)\ 35 (((compound_mode_access)&(elementary_mode_access))? 1:0) 36 37 38typedef enum M4OSA_LastSeek 39{ 40 SeekNone, 41 SeekRead, 42 SeekWrite 43} M4OSA_LastSeek; 44 45/** This structure defines the file context*/ 46typedef struct { 47 M4OSA_UInt32 coreID_read; 48 M4OSA_UInt32 coreID_write; 49 FILE* file_desc; 50 /** The name of the URL */ 51 M4OSA_Char* url_name; 52 /** The name of the file */ 53 M4OSA_Char* file_name; 54 /** The size in bytes of the file */ 55 M4OSA_FilePosition file_size; 56 /** The file mode access used to open the file */ 57 M4OSA_FileModeAccess access_mode; 58 M4OSA_LastSeek current_seek; 59 M4OSA_FilePosition read_position; 60 M4OSA_FilePosition write_position; 61 M4OSA_Bool b_is_end_of_file; 62 63#ifdef M4OSA_FILE_BLOCK_WITH_SEMAPHORE 64 M4OSA_Context semaphore_context; 65#endif /* M4OSA_FILE_BLOCK_WITH_SEMAPHORE */ 66 67 68 /* These two variables were added to manage case where a file 69 * is opened in read and write mode with one descriptor */ 70 M4OSA_DescrModeAccess m_DescrModeAccess; 71 M4OSA_UInt32 m_uiLockMode; 72 73 74} M4OSA_FileContext; 75 76 77 78M4OSA_ERR M4OSA_fileCommonOpen(M4OSA_UInt16 core_id, 79 M4OSA_Context* context, 80 M4OSA_Char* URL, 81 M4OSA_FileModeAccess fileModeAccess); 82 83M4OSA_ERR M4OSA_fileCommonClose(M4OSA_UInt16 core_id, 84 M4OSA_Context context); 85 86M4OSA_ERR M4OSA_fileCommonGetAttribute(M4OSA_Context context, 87 M4OSA_FileAttribute* attribute); 88 89M4OSA_ERR M4OSA_fileCommonGetURL(M4OSA_Context context, 90 M4OSA_Char** url); 91 92M4OSA_ERR M4OSA_fileCommonGetFilename(M4OSA_Char* url, 93 M4OSA_Char** filename); 94 95M4OSA_ERR M4OSA_fileCommonSeek(M4OSA_Context context, 96 M4OSA_FileSeekAccessMode seekMode, 97 M4OSA_FilePosition* position); 98 99#ifdef UTF_CONVERSION 100M4OSA_ERR M4OSA_ToUTF8_OSAL (M4OSA_Void *pBufferIn, 101 M4OSA_UInt8 *pBufferOut, 102 M4OSA_UInt32 *bufferOutSize); 103#endif /*UTF_CONVERSION*/ 104 105 106#endif /*M4OSA_FILECOMMON_PRIV_H*/ 107 108