1 /* 2 * Copyright 2024 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef OS_DIRENT_H 18 #define OS_DIRENT_H 19 20 #include <limits.h> 21 #include <sys/types.h> 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 struct os_dirent { 28 ino_t d_ino; 29 char d_name[NAME_MAX + 1]; 30 }; 31 32 #define OS_INO_UNKNOWN (0xFFFFFFFFFFFFFFFFul) 33 34 typedef struct os_dir os_dir_t; 35 36 os_dir_t* os_opendir(const char* path); 37 38 // Not threadsafe. 39 struct os_dirent* os_readdir(os_dir_t* dir); 40 41 int os_closedir(os_dir_t* dir); 42 43 #ifdef __cplusplus 44 } 45 #endif 46 47 #endif /* OS_DIRENT_H */ 48