GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: fx_directory_local_path_restore.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
/*  FUNCTION                                               RELEASE        */
41
/*                                                                        */
42
/*    _fx_directory_local_path_restore                    PORTABLE C      */
43
/*                                                           6.1.5        */
44
/*  AUTHOR                                                                */
45
/*                                                                        */
46
/*    William E. Lamie, Microsoft Corporation                             */
47
/*                                                                        */
48
/*  DESCRIPTION                                                           */
49
/*                                                                        */
50
/*    This function restores the local default directory of the media to  */
51
/*    the previous path specified by the caller.                          */
52
/*                                                                        */
53
/*  INPUT                                                                 */
54
/*                                                                        */
55
/*    media_ptr                             Media control block pointer   */
56
/*    local_path_ptr                        Local path control block ptr  */
57
/*                                                                        */
58
/*  OUTPUT                                                                */
59
/*                                                                        */
60
/*    return status                                                       */
61
/*                                                                        */
62
/*  CALLS                                                                 */
63
/*                                                                        */
64
/*    None                                                                */
65
/*                                                                        */
66
/*  CALLED BY                                                             */
67
/*                                                                        */
68
/*    Application Code                                                    */
69
/*                                                                        */
70
/**************************************************************************/
71
70
UINT  _fx_directory_local_path_restore(FX_MEDIA *media_ptr, FX_LOCAL_PATH *local_path_ptr)
72
{
73
74
75
#ifndef FX_MEDIA_STATISTICS_DISABLE
76
77
    /* Increment the number of times this service has been called.  */
78
70
    media_ptr -> fx_media_directory_local_path_restores++;
79
#endif
80
81
    /* Check the media to make sure it is open.  */
82
70
    if (media_ptr -> fx_media_id != FX_MEDIA_ID)
83
    {
84
85
        /* Return the media not opened error.  */
86
1
        return(FX_MEDIA_NOT_OPEN);
87
    }
88
89
#ifdef FX_NO_LOCAL_PATH
90
91
    FX_PARAMETER_NOT_USED(local_path_ptr);
92
93
    /* Error, return to caller.  */
94
    return(FX_NOT_IMPLEMENTED);
95
#else
96
97
    /* If trace is enabled, insert this event into the trace buffer.  */
98
    FX_TRACE_IN_LINE_INSERT(FX_TRACE_DIRECTORY_LOCAL_PATH_RESTORE, media_ptr, local_path_ptr, 0, 0, FX_TRACE_DIRECTORY_EVENTS, 0, 0)
99
100
    /* Setup thread control block to use this local path pointer.  */
101
69
    _tx_thread_current_ptr -> tx_thread_filex_ptr =  (VOID *)local_path_ptr;
102
103
    /* Default directory restore is complete, return status.  */
104
69
    return(FX_SUCCESS);
105
#endif
106
}
107