GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: fx_directory_default_get.c Lines: 8 8 100.0 %
Date: 2024-03-11 05:15:45 Branches: 2 2 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_directory.h"
29
30
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _fx_directory_default_get                           PORTABLE C      */
36
/*                                                           6.1          */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    William E. Lamie, Microsoft Corporation                             */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    This function returns the pointer of the last path provided to the  */
44
/*    fx_directory_default_set function.                                  */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    media_ptr                             Media control block pointer   */
49
/*    return_path_name                      Destination string pointer    */
50
/*                                            address                     */
51
/*                                                                        */
52
/*  OUTPUT                                                                */
53
/*                                                                        */
54
/*    return status                                                       */
55
/*                                                                        */
56
/*  CALLS                                                                 */
57
/*                                                                        */
58
/*    None                                                                */
59
/*                                                                        */
60
/*  CALLED BY                                                             */
61
/*                                                                        */
62
/*    Application Code                                                    */
63
/*                                                                        */
64
/*  RELEASE HISTORY                                                       */
65
/*                                                                        */
66
/*    DATE              NAME                      DESCRIPTION             */
67
/*                                                                        */
68
/*  05-19-2020     William E. Lamie         Initial Version 6.0           */
69
/*  09-30-2020     William E. Lamie         Modified comment(s),          */
70
/*                                            resulting in version 6.1    */
71
/*                                                                        */
72
/**************************************************************************/
73
19
UINT  _fx_directory_default_get(FX_MEDIA *media_ptr, CHAR **return_path_name)
74
{
75
76
#ifndef FX_MEDIA_STATISTICS_DISABLE
77
78
    /* Increment the number of times this service has been called.  */
79
19
    media_ptr -> fx_media_directory_default_gets++;
80
#endif
81
82
    /* Check the media to make sure it is open.  */
83
19
    if (media_ptr -> fx_media_id != FX_MEDIA_ID)
84
    {
85
86
        /* Return the media not opened error.  */
87
3
        return(FX_MEDIA_NOT_OPEN);
88
    }
89
90
    /* If trace is enabled, insert this event into the trace buffer.  */
91
    FX_TRACE_IN_LINE_INSERT(FX_TRACE_DIRECTORY_DEFAULT_GET, media_ptr, return_path_name, 0, 0, FX_TRACE_DIRECTORY_EVENTS, 0, 0)
92
93
    /* Protect against other threads accessing the media.  */
94
16
    FX_PROTECT
95
96
    /* Return the last pointer supplied to the set default directory function.  */
97
16
    *return_path_name = media_ptr -> fx_media_default_path.fx_path_string;
98
99
    /* Release media protection.  */
100
16
    FX_UNPROTECT
101
102
    /* Return successful status.  */
103
16
    return(FX_SUCCESS);
104
}
105