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 /**   Fault Tolerant                                                      */
18 /**                                                                       */
19 /**************************************************************************/
20 /**************************************************************************/
21 
22 #define FX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "fx_api.h"
28 #ifdef FX_ENABLE_FAULT_TOLERANT
29 #include "fx_fault_tolerant.h"
30 
31 FX_CALLER_CHECKING_EXTERNS
32 
33 
34 /**************************************************************************/
35 /*                                                                        */
36 /*  FUNCTION                                               RELEASE        */
37 /*                                                                        */
38 /*    _fxe_fault_tolerant_enable                          PORTABLE C      */
39 /*                                                           6.1          */
40 /*  AUTHOR                                                                */
41 /*                                                                        */
42 /*    William E. Lamie, Microsoft Corporation                             */
43 /*                                                                        */
44 /*  DESCRIPTION                                                           */
45 /*                                                                        */
46 /*    This function checks for errors in the fault tolerant enable call.  */
47 /*                                                                        */
48 /*  INPUT                                                                 */
49 /*                                                                        */
50 /*    media_ptr                             Media control block pointer   */
51 /*    memory_buffer                         Pointer to memory buffer.     */
52 /*    memory_size                           Size of memory buffer. It must*/
53 /*                                            be one sector.              */
54 /*                                                                        */
55 /*  OUTPUT                                                                */
56 /*                                                                        */
57 /*    return status                                                       */
58 /*                                                                        */
59 /*  CALLS                                                                 */
60 /*                                                                        */
61 /*    _fx_fault_tolerant_enable             Actual enable service         */
62 /*                                                                        */
63 /*  CALLED BY                                                             */
64 /*                                                                        */
65 /*    Application Code                                                    */
66 /*                                                                        */
67 /*  RELEASE HISTORY                                                       */
68 /*                                                                        */
69 /*    DATE              NAME                      DESCRIPTION             */
70 /*                                                                        */
71 /*  05-19-2020     William E. Lamie         Initial Version 6.0           */
72 /*  09-30-2020     William E. Lamie         Modified comment(s),          */
73 /*                                            resulting in version 6.1    */
74 /*                                                                        */
75 /**************************************************************************/
_fxe_fault_tolerant_enable(FX_MEDIA * media_ptr,VOID * memory_buffer,UINT memory_size)76 UINT  _fxe_fault_tolerant_enable(FX_MEDIA *media_ptr, VOID *memory_buffer, UINT memory_size)
77 {
78 
79 UINT status;
80 
81 
82     /* Check for a null media pointer or buffer pointer.  */
83     if ((media_ptr == FX_NULL) || (memory_buffer == FX_NULL))
84     {
85         return(FX_PTR_ERROR);
86     }
87 
88     /* Check for a valid caller.  */
89     FX_CALLER_CHECKING_CODE
90 
91     /* Call actual fault tolerant enable service.  */
92     status =  _fx_fault_tolerant_enable(media_ptr, memory_buffer, memory_size);
93 
94     /* Return status to the caller.  */
95     return(status);
96 }
97 #endif /* FX_ENABLE_FAULT_TOLERANT */
98 
99