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 /**   File                                                                */
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_file.h"
29 
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _fx_file_seek                                       PORTABLE C      */
36 /*                                                           6.1          */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    William E. Lamie, Microsoft Corporation                             */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function positions the internal file pointers to the specified */
44 /*    byte offset such that the next read or write operation will be      */
45 /*    performed there.  If the byte offset is greater than the size, the  */
46 /*    file pointers will be positioned to the end of the file.            */
47 /*                                                                        */
48 /*  INPUT                                                                 */
49 /*                                                                        */
50 /*    file_ptr                              File control block pointer    */
51 /*    byte_offset                           Byte offset into the file     */
52 /*                                                                        */
53 /*  OUTPUT                                                                */
54 /*                                                                        */
55 /*    return status                                                       */
56 /*                                                                        */
57 /*  CALLS                                                                 */
58 /*                                                                        */
59 /*    _fx_file_extended_seek                Seek to specified position    */
60 /*                                                                        */
61 /*  CALLED BY                                                             */
62 /*                                                                        */
63 /*    Application Code                                                    */
64 /*                                                                        */
65 /*  RELEASE HISTORY                                                       */
66 /*                                                                        */
67 /*    DATE              NAME                      DESCRIPTION             */
68 /*                                                                        */
69 /*  05-19-2020     William E. Lamie         Initial Version 6.0           */
70 /*  09-30-2020     William E. Lamie         Modified comment(s), and      */
71 /*                                            Added conditional to        */
72 /*                                            disable one line function,  */
73 /*                                            resulting in version 6.1    */
74 /*                                                                        */
75 /**************************************************************************/
76 #ifndef FX_DISABLE_ONE_LINE_FUNCTION
_fx_file_seek(FX_FILE * file_ptr,ULONG byte_offset)77 UINT  _fx_file_seek(FX_FILE *file_ptr, ULONG byte_offset)
78 {
79 
80     return(_fx_file_extended_seek(file_ptr, (ULONG64) byte_offset));
81 }
82 #endif /* FX_DISABLE_ONE_LINE_FUNCTION */
83