GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: fx_directory_local_path_get.c Lines: 8 8 100.0 %
Date: 2024-03-11 05:15:45 Branches: 4 4 100.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
/**   Directory                                                           */
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_system.h"
29
#include "fx_file.h"
30
#include "fx_utility.h"
31
#include "fx_directory.h"
32
33
#ifndef FX_NO_LOCAL_PATH
34
FX_LOCAL_PATH_SETUP
35
#endif
36
37
/**************************************************************************/
38
/*                                                                        */
39
/*  FUNCTION                                               RELEASE        */
40
/*                                                                        */
41
/*    _fx_directory_local_path_get                        PORTABLE C      */
42
/*                                                           6.1.5        */
43
/*  AUTHOR                                                                */
44
/*                                                                        */
45
/*    William E. Lamie, Microsoft Corporation                             */
46
/*                                                                        */
47
/*  DESCRIPTION                                                           */
48
/*                                                                        */
49
/*    This function returns a pointer to the local default directory      */
50
/*    for this thread.                                                    */
51
/*                                                                        */
52
/*  INPUT                                                                 */
53
/*                                                                        */
54
/*    media_ptr                             Media control block pointer   */
55
/*    return_path_name                      Return local path name        */
56
/*                                                                        */
57
/*  OUTPUT                                                                */
58
/*                                                                        */
59
/*    return status                                                       */
60
/*                                                                        */
61
/*  CALLS                                                                 */
62
/*                                                                        */
63
/*    None                                                                */
64
/*                                                                        */
65
/*  CALLED BY                                                             */
66
/*                                                                        */
67
/*    Application Code                                                    */
68
/*                                                                        */
69
/*  RELEASE HISTORY                                                       */
70
/*                                                                        */
71
/*    DATE              NAME                      DESCRIPTION             */
72
/*                                                                        */
73
/*  05-19-2020     William E. Lamie         Initial Version 6.0           */
74
/*  09-30-2020     William E. Lamie         Modified comment(s),          */
75
/*                                            resulting in version 6.1    */
76
/*  03-02-2021     William E. Lamie         Modified comment(s),          */
77
/*                                            resulting in version 6.1.5  */
78
/*                                                                        */
79
/**************************************************************************/
80
7
UINT  _fx_directory_local_path_get(FX_MEDIA *media_ptr, CHAR **return_path_name)
81
{
82
83
84
#ifndef FX_MEDIA_STATISTICS_DISABLE
85
86
    /* Increment the number of times this service has been called.  */
87
7
    media_ptr -> fx_media_directory_local_path_gets++;
88
#endif
89
90
    /* Check the media to make sure it is open.  */
91
7
    if (media_ptr -> fx_media_id != FX_MEDIA_ID)
92
    {
93
94
        /* Return the media not opened error.  */
95
2
        return(FX_MEDIA_NOT_OPEN);
96
    }
97
98
#ifdef FX_NO_LOCAL_PATH
99
100
    FX_PARAMETER_NOT_USED(return_path_name);
101
102
    /* Error, return to caller.  */
103
    return(FX_NOT_IMPLEMENTED);
104
#else
105
106
    /* Determine if there is a local path.  */
107
5
    if (_tx_thread_current_ptr -> tx_thread_filex_ptr)
108
    {
109
110
        /* Return a pointer to the current local directory path string.  */
111
3
        *return_path_name =  ((FX_LOCAL_PATH *)_tx_thread_current_ptr -> tx_thread_filex_ptr) -> fx_path_string;
112
    }
113
    else
114
    {
115
116
        /* Just set the return value to FX_NULL to indicate there is no
117
           local path setup.  */
118
2
        *return_path_name =  FX_NULL;
119
    }
120
121
    /* If trace is enabled, insert this event into the trace buffer.  */
122
    FX_TRACE_IN_LINE_INSERT(FX_TRACE_DIRECTORY_LOCAL_PATH_GET, media_ptr, return_path_name, 0, 0, FX_TRACE_DIRECTORY_EVENTS, 0, 0)
123
124
    /* Local default directory has been returned, return status.  */
125
5
    return(FX_SUCCESS);
126
#endif
127
}
128