1 /*************************************************************************** 2 * Copyright (c) 2024 Microsoft Corporation 3 * 4 * This program and the accompanying materials are made available under the 5 * terms of the MIT License which is available at 6 * https://opensource.org/licenses/MIT. 7 * 8 * SPDX-License-Identifier: MIT 9 **************************************************************************/ 10 11 12 /**************************************************************************/ 13 /**************************************************************************/ 14 /** */ 15 /** FileX Component */ 16 /** */ 17 /** File */ 18 /** */ 19 /**************************************************************************/ 20 /**************************************************************************/ 21 22 23 /**************************************************************************/ 24 /* */ 25 /* COMPONENT DEFINITION RELEASE */ 26 /* */ 27 /* fx_file.h PORTABLE C */ 28 /* 6.1 */ 29 /* AUTHOR */ 30 /* */ 31 /* William E. Lamie, Microsoft Corporation */ 32 /* */ 33 /* DESCRIPTION */ 34 /* */ 35 /* This file defines the FileX File component constants, data */ 36 /* definitions, and external references. It is assumed that fx_api.h */ 37 /* (and fx_port.h) have already been included. */ 38 /* */ 39 /* RELEASE HISTORY */ 40 /* */ 41 /* DATE NAME DESCRIPTION */ 42 /* */ 43 /* 05-19-2020 William E. Lamie Initial Version 6.0 */ 44 /* 09-30-2020 William E. Lamie Modified comment(s), and */ 45 /* added conditional to */ 46 /* disable one line function, */ 47 /* resulting in version 6.1 */ 48 /* */ 49 /**************************************************************************/ 50 51 #ifndef FX_FILE_H 52 #define FX_FILE_H 53 54 55 /* Define the external File component function prototypes. */ 56 57 #ifndef FX_DISABLE_ONE_LINE_FUNCTION 58 UINT _fx_file_allocate(FX_FILE *file_ptr, ULONG size); 59 #else 60 #define _fx_file_allocate(f, s) _fx_file_extended_allocate(f, (ULONG64)s); 61 #endif /* FX_DISABLE_ONE_LINE_FUNCTION */ 62 UINT _fx_file_attributes_read(FX_MEDIA *media_ptr, CHAR *file_name, UINT *attributes_ptr); 63 UINT _fx_file_attributes_set(FX_MEDIA *media_ptr, CHAR *file_name, UINT attributes); 64 UINT _fx_file_best_effort_allocate(FX_FILE *file_ptr, ULONG size, ULONG *actual_size_allocated); 65 UINT _fx_file_close(FX_FILE *file_ptr); 66 UINT _fx_file_create(FX_MEDIA *media_ptr, CHAR *file_name); 67 UINT _fx_file_date_time_set(FX_MEDIA *media_ptr, CHAR *file_name, 68 UINT year, UINT month, UINT day, UINT hour, UINT minute, UINT second); 69 UINT _fx_file_delete(FX_MEDIA *media_ptr, CHAR *file_name); 70 UINT _fx_file_open(FX_MEDIA *media_ptr, FX_FILE *file_ptr, CHAR *file_name, 71 UINT open_type); 72 UINT _fx_file_read(FX_FILE *file_ptr, VOID *buffer_ptr, ULONG request_size, ULONG *actual_size); 73 #ifndef FX_DISABLE_ONE_LINE_FUNCTION 74 UINT _fx_file_relative_seek(FX_FILE *file_ptr, ULONG byte_offset, UINT seek_from); 75 #else 76 #define _fx_file_relative_seek(f, b, sf) _fx_file_extended_relative_seek(f, (ULONG64)b, sf); 77 #endif /* FX_DISABLE_ONE_LINE_FUNCTION */ 78 UINT _fx_file_rename(FX_MEDIA *media_ptr, CHAR *old_file_name, CHAR *new_file_name); 79 #ifndef FX_DISABLE_ONE_LINE_FUNCTION 80 UINT _fx_file_seek(FX_FILE *file_ptr, ULONG byte_offset); 81 UINT _fx_file_truncate(FX_FILE *file_ptr, ULONG size); 82 UINT _fx_file_truncate_release(FX_FILE *file_ptr, ULONG size); 83 #else 84 #define _fx_file_seek(f, b) _fx_file_extended_seek(f, (ULONG64)b) 85 #define _fx_file_truncate(f, s) _fx_file_extended_truncate(f, (ULONG64)s); 86 #define _fx_file_truncate_release(f, s) _fx_file_extended_truncate_release(f, (ULONG64)s); 87 #endif /* FX_DISABLE_ONE_LINE_FUNCTION */ 88 UINT _fx_file_write(FX_FILE *file_ptr, VOID *buffer_ptr, ULONG size); 89 UINT _fx_file_write_notify_set(FX_FILE *file_ptr, VOID (*file_write_notify)(FX_FILE *)); 90 UINT _fx_file_extended_allocate(FX_FILE *file_ptr, ULONG64 size); 91 UINT _fx_file_extended_best_effort_allocate(FX_FILE *file_ptr, ULONG64 size, ULONG64 *actual_size_allocated); 92 UINT _fx_file_extended_relative_seek(FX_FILE *file_ptr, ULONG64 byte_offset, UINT seek_from); 93 UINT _fx_file_extended_seek(FX_FILE *file_ptr, ULONG64 byte_offset); 94 UINT _fx_file_extended_truncate(FX_FILE *file_ptr, ULONG64 size); 95 UINT _fx_file_extended_truncate_release(FX_FILE *file_ptr, ULONG64 size); 96 97 UINT _fxe_file_allocate(FX_FILE *file_ptr, ULONG size); 98 UINT _fxe_file_attributes_read(FX_MEDIA *media_ptr, CHAR *file_name, UINT *attributes_ptr); 99 UINT _fxe_file_attributes_set(FX_MEDIA *media_ptr, CHAR *file_name, UINT attributes); 100 UINT _fxe_file_best_effort_allocate(FX_FILE *file_ptr, ULONG size, ULONG *actual_size_allocated); 101 UINT _fxe_file_close(FX_FILE *file_ptr); 102 UINT _fxe_file_create(FX_MEDIA *media_ptr, CHAR *file_name); 103 UINT _fxe_file_date_time_set(FX_MEDIA *media_ptr, CHAR *file_name, 104 UINT year, UINT month, UINT day, UINT hour, UINT minute, UINT second); 105 UINT _fxe_file_delete(FX_MEDIA *media_ptr, CHAR *file_name); 106 UINT _fxe_file_open(FX_MEDIA *media_ptr, FX_FILE *file_ptr, CHAR *file_name, 107 UINT open_type, UINT file_control_block_size); 108 UINT _fxe_file_read(FX_FILE *file_ptr, VOID *buffer_ptr, ULONG request_size, ULONG *actual_size); 109 UINT _fxe_file_relative_seek(FX_FILE *file_ptr, ULONG byte_offset, UINT seek_from); 110 UINT _fxe_file_rename(FX_MEDIA *media_ptr, CHAR *old_file_name, CHAR *new_file_name); 111 UINT _fxe_file_seek(FX_FILE *file_ptr, ULONG byte_offset); 112 UINT _fxe_file_truncate(FX_FILE *file_ptr, ULONG size); 113 UINT _fxe_file_truncate_release(FX_FILE *file_ptr, ULONG size); 114 UINT _fxe_file_write(FX_FILE *file_ptr, VOID *buffer_ptr, ULONG size); 115 UINT _fxe_file_write_notify_set(FX_FILE *file_ptr, VOID (*file_write_notify)(FX_FILE *)); 116 UINT _fxe_file_extended_allocate(FX_FILE *file_ptr, ULONG64 size); 117 UINT _fxe_file_extended_best_effort_allocate(FX_FILE *file_ptr, ULONG64 size, ULONG64 *actual_size_allocated); 118 UINT _fxe_file_extended_relative_seek(FX_FILE *file_ptr, ULONG64 byte_offset, UINT seek_from); 119 UINT _fxe_file_extended_seek(FX_FILE *file_ptr, ULONG64 byte_offset); 120 UINT _fxe_file_extended_truncate(FX_FILE *file_ptr, ULONG64 size); 121 UINT _fxe_file_extended_truncate_release(FX_FILE *file_ptr, ULONG64 size); 122 123 #endif 124 125