GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: fx_directory_local_path_clear.c Lines: 6 6 100.0 %
Date: 2026-03-06 18:49:02 Branches: 2 2 100.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
/**   Directory                                                           */
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_system.h"
30
#include "fx_file.h"
31
#include "fx_utility.h"
32
#include "fx_directory.h"
33
34
#ifndef FX_NO_LOCAL_PATH
35
FX_LOCAL_PATH_SETUP
36
#endif
37
38
39
/**************************************************************************/
40
/*                                                                        */
41
/*  FUNCTION                                               RELEASE        */
42
/*                                                                        */
43
/*    _fx_directory_local_path_clear                      PORTABLE C      */
44
/*                                                           6.1          */
45
/*  AUTHOR                                                                */
46
/*                                                                        */
47
/*    William E. Lamie, Microsoft Corporation                             */
48
/*                                                                        */
49
/*  DESCRIPTION                                                           */
50
/*                                                                        */
51
/*    This function clears the local default directory of the media so    */
52
/*    any path relative operations will start using the media's global    */
53
/*    default path again.                                                 */
54
/*                                                                        */
55
/*  INPUT                                                                 */
56
/*                                                                        */
57
/*    media_ptr                             Media control block pointer   */
58
/*                                                                        */
59
/*  OUTPUT                                                                */
60
/*                                                                        */
61
/*    return status                                                       */
62
/*                                                                        */
63
/*  CALLS                                                                 */
64
/*                                                                        */
65
/*    None                                                                */
66
/*                                                                        */
67
/*  CALLED BY                                                             */
68
/*                                                                        */
69
/*    Application Code                                                    */
70
/*                                                                        */
71
/**************************************************************************/
72
76
UINT  _fx_directory_local_path_clear(FX_MEDIA *media_ptr)
73
{
74
75
76
#ifndef FX_MEDIA_STATISTICS_DISABLE
77
78
    /* Increment the number of times this service has been called.  */
79
76
    media_ptr -> fx_media_directory_local_path_clears++;
80
#endif
81
82
    /* Check the media to make sure it is open.  */
83
76
    if (media_ptr -> fx_media_id != FX_MEDIA_ID)
84
    {
85
86
        /* Return the media not opened error.  */
87
1
        return(FX_MEDIA_NOT_OPEN);
88
    }
89
90
#ifdef FX_NO_LOCAL_PATH
91
92
    /* Error, return to caller.  */
93
    return(FX_NOT_IMPLEMENTED);
94
#else
95
96
    /* If trace is enabled, insert this event into the trace buffer.  */
97
    FX_TRACE_IN_LINE_INSERT(FX_TRACE_DIRECTORY_LOCAL_PATH_CLEAR, media_ptr, 0, 0, 0, FX_TRACE_DIRECTORY_EVENTS, 0, 0)
98
99
    /* Clear this thread's local path pointer.  */
100
75
    _tx_thread_current_ptr -> tx_thread_filex_ptr =  FX_NULL;
101
102
    /* Local default directory clear is complete, return status.  */
103
75
    return(FX_SUCCESS);
104
#endif
105
}
106