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 #define FX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "fx_api.h"
28 #include "fx_file.h"
29 
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _fx_file_allocate                                   PORTABLE C      */
36 /*                                                           6.1          */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    William E. Lamie, Microsoft Corporation                             */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function attempts to allocate the number of consecutive        */
44 /*    clusters required to satisfy the user's request.  If there are      */
45 /*    enough clusters, the clusters are allocated and linked to the file. */
46 /*    Otherwise, if there are not enough consecutive clusters, an error   */
47 /*    code is returned to the caller.                                     */
48 /*                                                                        */
49 /*  INPUT                                                                 */
50 /*                                                                        */
51 /*    file_ptr                              File control block pointer    */
52 /*    size                                  Number of bytes to allocate   */
53 /*                                                                        */
54 /*  OUTPUT                                                                */
55 /*                                                                        */
56 /*    return status                                                       */
57 /*                                                                        */
58 /*  CALLS                                                                 */
59 /*                                                                        */
60 /*    _fx_file_extended_allocate            Allocate the clusters         */
61 /*                                                                        */
62 /*  CALLED BY                                                             */
63 /*                                                                        */
64 /*    Application Code                                                    */
65 /*                                                                        */
66 /*  RELEASE HISTORY                                                       */
67 /*                                                                        */
68 /*    DATE              NAME                      DESCRIPTION             */
69 /*                                                                        */
70 /*  05-19-2020     William E. Lamie         Initial Version 6.0           */
71 /*  09-30-2020     William E. Lamie         Modified comment(s), and      */
72 /*                                            Added conditional to        */
73 /*                                            disable one line function,  */
74 /*                                            resulting in version 6.1    */
75 /*                                                                        */
76 /**************************************************************************/
77 #ifndef FX_DISABLE_ONE_LINE_FUNCTION
_fx_file_allocate(FX_FILE * file_ptr,ULONG size)78 UINT  _fx_file_allocate(FX_FILE *file_ptr, ULONG size)
79 {
80 
81     return(_fx_file_extended_allocate(file_ptr, (ULONG64)size));
82 }
83 #endif /* FX_DISABLE_ONE_LINE_FUNCTION */
84