-
Notifications
You must be signed in to change notification settings - Fork 217
/
os-shared-dir.h
114 lines (86 loc) · 3.81 KB
/
os-shared-dir.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
/*
* NASA Docket No. GSC-18,370-1, and identified as "Operating System Abstraction Layer"
*
* Copyright (c) 2019 United States Government as represented by
* the Administrator of the National Aeronautics and Space Administration.
* All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* \file os-shared-dir.h
* \ingroup shared
* \author [email protected]
*
*/
#ifndef OS_SHARED_DIR_H
#define OS_SHARED_DIR_H
#include "osapi-dir.h"
#include <os-shared-globaldefs.h>
/* directory objects */
typedef struct
{
char dir_name[OS_MAX_PATH_LEN];
} OS_dir_internal_record_t;
/*
* These record types have extra information with each entry. These tables are used
* to share extra data between the common layer and the OS-specific implementation.
*/
extern OS_dir_internal_record_t OS_dir_table[OS_MAX_NUM_OPEN_DIRS];
/*
* Directory API abstraction layer
*
*/
/*---------------------------------------------------------------------------------------
Name: OS_DirAPI_Init
Purpose: Initialize the OS-independent layer for directory resources
returns: OS_SUCCESS on success, or relevant error code
---------------------------------------------------------------------------------------*/
int32 OS_DirAPI_Init(void);
/*----------------------------------------------------------------
Function: OS_DirCreate_Impl
Purpose: Create a directory in the local filesystem
Returns: OS_SUCCESS on success, or relevant error code
------------------------------------------------------------------*/
int32 OS_DirCreate_Impl(const char *local_path, uint32 access);
/*----------------------------------------------------------------
Function: OS_DirOpen_Impl
Purpose: Open a directory and prepare to read the entries
Returns: OS_SUCCESS on success, or relevant error code
------------------------------------------------------------------*/
int32 OS_DirOpen_Impl(const OS_object_token_t *token, const char *local_path);
/*----------------------------------------------------------------
Function: OS_DirClose_Impl
Purpose: Close a directory
Returns: OS_SUCCESS on success, or relevant error code
------------------------------------------------------------------*/
int32 OS_DirClose_Impl(const OS_object_token_t *token);
/*----------------------------------------------------------------
Function: OS_DirRead_Impl
Purpose: Read the next entry from a directory handle
Returns: OS_SUCCESS on success, or relevant error code
------------------------------------------------------------------*/
int32 OS_DirRead_Impl(const OS_object_token_t *token, os_dirent_t *dirent);
/*----------------------------------------------------------------
Function: OS_DirRewind_Impl
Purpose: Rewind a directory handle back to the start
Returns: OS_SUCCESS on success, or relevant error code
------------------------------------------------------------------*/
int32 OS_DirRewind_Impl(const OS_object_token_t *token);
/*----------------------------------------------------------------
Function: OS_DirRemove_Impl
Purpose: Remove a directory in the local filesystem
Returns: OS_SUCCESS on success, or relevant error code
------------------------------------------------------------------*/
int32 OS_DirRemove_Impl(const char *local_path);
#endif /* OS_SHARED_DIR_H */