GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: fx_file_truncate_release.c Lines: 2 2 100.0 %
Date: 2026-03-06 18:49:02 Branches: 0 0 - %

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_truncate_release                           PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    William E. Lamie, Microsoft Corporation                             */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This function sets the file to the specified size, if smaller than  */
45
/*    the current file size.  If the new file size is less than the       */
46
/*    current file read/write position, the internal file pointers will   */
47
/*    also be modified.  Any unused clusters are released back to the     */
48
/*    media.                                                              */
49
/*                                                                        */
50
/*  INPUT                                                                 */
51
/*                                                                        */
52
/*    file_ptr                              File control block pointer    */
53
/*    size                                  New size of the file in bytes */
54
/*                                                                        */
55
/*  OUTPUT                                                                */
56
/*                                                                        */
57
/*    return status                                                       */
58
/*                                                                        */
59
/*  CALLS                                                                 */
60
/*                                                                        */
61
/*    _fx_file_extended_truncate_release    Truncate the file size and    */
62
/*                                            released unused clusters    */
63
/*                                                                        */
64
/*  CALLED BY                                                             */
65
/*                                                                        */
66
/*    Application Code                                                    */
67
/*                                                                        */
68
/**************************************************************************/
69
#ifndef FX_DISABLE_ONE_LINE_FUNCTION
70
2
UINT  _fx_file_truncate_release(FX_FILE *file_ptr, ULONG size)
71
{
72
73
2
    return(_fx_file_extended_truncate_release(file_ptr, (ULONG64)size));
74
}
75
#endif /* FX_DISABLE_ONE_LINE_FUNCTION */
76