GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: fx_file_truncate_release.c Lines: 2 2 100.0 %
Date: 2024-03-11 05:15:45 Branches: 0 0 - %

Line Branch Exec Source
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_release                           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.  Any unused clusters are released back to the     */
47
/*    media.                                                              */
48
/*                                                                        */
49
/*  INPUT                                                                 */
50
/*                                                                        */
51
/*    file_ptr                              File control block pointer    */
52
/*    size                                  New size of the file in bytes */
53
/*                                                                        */
54
/*  OUTPUT                                                                */
55
/*                                                                        */
56
/*    return status                                                       */
57
/*                                                                        */
58
/*  CALLS                                                                 */
59
/*                                                                        */
60
/*    _fx_file_extended_truncate_release    Truncate the file size and    */
61
/*                                            released unused clusters    */
62
/*                                                                        */
63
/*  CALLED BY                                                             */
64
/*                                                                        */
65
/*    Application Code                                                    */
66
/*                                                                        */
67
/*  RELEASE HISTORY                                                       */
68
/*                                                                        */
69
/*    DATE              NAME                      DESCRIPTION             */
70
/*                                                                        */
71
/*  05-19-2020     William E. Lamie         Initial Version 6.0           */
72
/*  09-30-2020     William E. Lamie         Modified comment(s), and      */
73
/*                                            Added conditional to        */
74
/*                                            disable one line function,  */
75
/*                                            resulting in version 6.1    */
76
/*                                                                        */
77
/**************************************************************************/
78
#ifndef FX_DISABLE_ONE_LINE_FUNCTION
79
2
UINT  _fx_file_truncate_release(FX_FILE *file_ptr, ULONG size)
80
{
81
82
2
    return(_fx_file_extended_truncate_release(file_ptr, (ULONG64)size));
83
}
84
#endif /* FX_DISABLE_ONE_LINE_FUNCTION */
85