fx_file_allocate.c
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*************************************************************************** | ||
| 2 | * Copyright (c) 2024 Microsoft Corporation | ||
| 3 | * Copyright (c) 2026-present Eclipse ThreadX contributors | ||
| 4 | * | ||
| 5 | * This program and the accompanying materials are made available under the | ||
| 6 | * terms of the MIT License which is available at | ||
| 7 | * https://opensource.org/licenses/MIT. | ||
| 8 | * | ||
| 9 | * SPDX-License-Identifier: MIT | ||
| 10 | **************************************************************************/ | ||
| 11 | |||
| 12 | |||
| 13 | /**************************************************************************/ | ||
| 14 | /**************************************************************************/ | ||
| 15 | /** */ | ||
| 16 | /** FileX Component */ | ||
| 17 | /** */ | ||
| 18 | /** File */ | ||
| 19 | /** */ | ||
| 20 | /**************************************************************************/ | ||
| 21 | /**************************************************************************/ | ||
| 22 | |||
| 23 | #define FX_SOURCE_CODE | ||
| 24 | |||
| 25 | |||
| 26 | /* Include necessary system files. */ | ||
| 27 | |||
| 28 | #include "fx_api.h" | ||
| 29 | #include "fx_file.h" | ||
| 30 | |||
| 31 | |||
| 32 | /**************************************************************************/ | ||
| 33 | /* */ | ||
| 34 | /* FUNCTION RELEASE */ | ||
| 35 | /* */ | ||
| 36 | /* _fx_file_allocate PORTABLE C */ | ||
| 37 | /* 6.1 */ | ||
| 38 | /* AUTHOR */ | ||
| 39 | /* */ | ||
| 40 | /* William E. Lamie, Microsoft Corporation */ | ||
| 41 | /* */ | ||
| 42 | /* DESCRIPTION */ | ||
| 43 | /* */ | ||
| 44 | /* This function attempts to allocate the number of consecutive */ | ||
| 45 | /* clusters required to satisfy the user's request. If there are */ | ||
| 46 | /* enough clusters, the clusters are allocated and linked to the file. */ | ||
| 47 | /* Otherwise, if there are not enough consecutive clusters, an error */ | ||
| 48 | /* code is returned to the caller. */ | ||
| 49 | /* */ | ||
| 50 | /* INPUT */ | ||
| 51 | /* */ | ||
| 52 | /* file_ptr File control block pointer */ | ||
| 53 | /* size Number of bytes to allocate */ | ||
| 54 | /* */ | ||
| 55 | /* OUTPUT */ | ||
| 56 | /* */ | ||
| 57 | /* return status */ | ||
| 58 | /* */ | ||
| 59 | /* CALLS */ | ||
| 60 | /* */ | ||
| 61 | /* _fx_file_extended_allocate Allocate the clusters */ | ||
| 62 | /* */ | ||
| 63 | /* CALLED BY */ | ||
| 64 | /* */ | ||
| 65 | /* Application Code */ | ||
| 66 | /* */ | ||
| 67 | /**************************************************************************/ | ||
| 68 | #ifndef FX_DISABLE_ONE_LINE_FUNCTION | ||
| 69 | 291 | UINT _fx_file_allocate(FX_FILE *file_ptr, ULONG size) | |
| 70 | { | ||
| 71 | |||
| 72 | 291 | return(_fx_file_extended_allocate(file_ptr, (ULONG64)size)); | |
| 73 | } | ||
| 74 | #endif /* FX_DISABLE_ONE_LINE_FUNCTION */ | ||
| 75 |