GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: fx_directory_local_path_get.c Lines: 8 8 100.0 %
Date: 2024-01-10 21:53:23 Branches: 4 4 100.0 %

Line Branch Exec Source
1
/**************************************************************************/
2
/*                                                                        */
3
/*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4
/*                                                                        */
5
/*       This software is licensed under the Microsoft Software License   */
6
/*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7
/*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8
/*       and in the root directory of this software.                      */
9
/*                                                                        */
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_get                        PORTABLE C      */
43
/*                                                           6.1.5        */
44
/*  AUTHOR                                                                */
45
/*                                                                        */
46
/*    William E. Lamie, Microsoft Corporation                             */
47
/*                                                                        */
48
/*  DESCRIPTION                                                           */
49
/*                                                                        */
50
/*    This function returns a pointer to the local default directory      */
51
/*    for this thread.                                                    */
52
/*                                                                        */
53
/*  INPUT                                                                 */
54
/*                                                                        */
55
/*    media_ptr                             Media control block pointer   */
56
/*    return_path_name                      Return local path name        */
57
/*                                                                        */
58
/*  OUTPUT                                                                */
59
/*                                                                        */
60
/*    return status                                                       */
61
/*                                                                        */
62
/*  CALLS                                                                 */
63
/*                                                                        */
64
/*    None                                                                */
65
/*                                                                        */
66
/*  CALLED BY                                                             */
67
/*                                                                        */
68
/*    Application Code                                                    */
69
/*                                                                        */
70
/*  RELEASE HISTORY                                                       */
71
/*                                                                        */
72
/*    DATE              NAME                      DESCRIPTION             */
73
/*                                                                        */
74
/*  05-19-2020     William E. Lamie         Initial Version 6.0           */
75
/*  09-30-2020     William E. Lamie         Modified comment(s),          */
76
/*                                            resulting in version 6.1    */
77
/*  03-02-2021     William E. Lamie         Modified comment(s),          */
78
/*                                            resulting in version 6.1.5  */
79
/*                                                                        */
80
/**************************************************************************/
81
7
UINT  _fx_directory_local_path_get(FX_MEDIA *media_ptr, CHAR **return_path_name)
82
{
83
84
85
#ifndef FX_MEDIA_STATISTICS_DISABLE
86
87
    /* Increment the number of times this service has been called.  */
88
7
    media_ptr -> fx_media_directory_local_path_gets++;
89
#endif
90
91
    /* Check the media to make sure it is open.  */
92
7
    if (media_ptr -> fx_media_id != FX_MEDIA_ID)
93
    {
94
95
        /* Return the media not opened error.  */
96
2
        return(FX_MEDIA_NOT_OPEN);
97
    }
98
99
#ifdef FX_NO_LOCAL_PATH
100
101
    FX_PARAMETER_NOT_USED(return_path_name);
102
103
    /* Error, return to caller.  */
104
    return(FX_NOT_IMPLEMENTED);
105
#else
106
107
    /* Determine if there is a local path.  */
108
5
    if (_tx_thread_current_ptr -> tx_thread_filex_ptr)
109
    {
110
111
        /* Return a pointer to the current local directory path string.  */
112
3
        *return_path_name =  ((FX_LOCAL_PATH *)_tx_thread_current_ptr -> tx_thread_filex_ptr) -> fx_path_string;
113
    }
114
    else
115
    {
116
117
        /* Just set the return value to FX_NULL to indicate there is no
118
           local path setup.  */
119
2
        *return_path_name =  FX_NULL;
120
    }
121
122
    /* If trace is enabled, insert this event into the trace buffer.  */
123
    FX_TRACE_IN_LINE_INSERT(FX_TRACE_DIRECTORY_LOCAL_PATH_GET, media_ptr, return_path_name, 0, 0, FX_TRACE_DIRECTORY_EVENTS, 0, 0)
124
125
    /* Local default directory has been returned, return status.  */
126
5
    return(FX_SUCCESS);
127
#endif
128
}
129