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_truncate PORTABLE C */
36 /* 6.1 */
37 /* AUTHOR */
38 /* */
39 /* William E. Lamie, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function sets the file to the specified size, if smaller than */
44 /* the current file size. If the new file size is less than the */
45 /* current file read/write position, the internal file pointers will */
46 /* also be modified. */
47 /* */
48 /* INPUT */
49 /* */
50 /* file_ptr File control block pointer */
51 /* size New size of the file in bytes */
52 /* */
53 /* OUTPUT */
54 /* */
55 /* return status */
56 /* */
57 /* CALLS */
58 /* */
59 /* _fx_file_extended_truncate Truncate the file size */
60 /* */
61 /* CALLED BY */
62 /* */
63 /* Application Code */
64 /* */
65 /* RELEASE HISTORY */
66 /* */
67 /* DATE NAME DESCRIPTION */
68 /* */
69 /* 05-19-2020 William E. Lamie Initial Version 6.0 */
70 /* 09-30-2020 William E. Lamie Modified comment(s), and */
71 /* Added conditional to */
72 /* disable one line function, */
73 /* resulting in version 6.1 */
74 /* */
75 /**************************************************************************/
76 #ifndef FX_DISABLE_ONE_LINE_FUNCTION
_fx_file_truncate(FX_FILE * file_ptr,ULONG size)77 UINT _fx_file_truncate(FX_FILE *file_ptr, ULONG size)
78 {
79
80 return(_fx_file_extended_truncate(file_ptr, (ULONG64)size));
81 }
82 #endif /* FX_DISABLE_ONE_LINE_FUNCTION */
83