1 /* 2 * Copyright (c) 2023-2023 Huawei Device Co., Ltd. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without modification, 5 * are permitted provided that the following conditions are met: 6 * 7 * 1. Redistributions of source code must retain the above copyright notice, this list of 8 * conditions and the following disclaimer. 9 * 10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list 11 * of conditions and the following disclaimer in the documentation and/or other materials 12 * provided with the distribution. 13 * 14 * 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 * to endorse or promote products derived from this software without specific prior written 16 * permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 #ifndef __POSIX_FS_TEST_H 32 #define __POSIX_FS_TEST_H 33 34 #include "posix_test.h" 35 #include <securec.h> 36 #include <stdio.h> 37 #include <libgen.h> 38 #include "ohos_types.h" 39 #include "los_config.h" 40 #include "vfs_files.h" 41 #include "vfs_mount.h" 42 #include "vfs_maps.h" 43 #include "kernel_test.h" 44 #include "log.h" 45 #include <fcntl.h> 46 #include <dirent.h> 47 #include <sys/stat.h> 48 #include <unistd.h> 49 #include "limits.h" 50 51 #if (LOSCFG_SUPPORT_FATFS == 1) 52 #define TEST_ROOT "system" 53 #endif 54 55 #if (LOSCFG_SUPPORT_LITTLEFS == 1) 56 #define TEST_ROOT "/littlefs" 57 #endif 58 59 #define TEST_FILE_PTAH_RIGHT TEST_ROOT"/FILE0" /* file path, to open/rd/close */ 60 #define FILE0 "FILE0" /* common file name used for testing */ 61 #define FILE1 TEST_ROOT"/FILE1" /* common file under test root path name used for testing */ 62 #define FILE2 TEST_ROOT"/FILE2" /* common file under test root path name used for testing */ 63 #define FILE3 TEST_ROOT"/FILE3" /* common file under test root path name used for testing */ 64 #define FILE4 TEST_ROOT"/FILE4" /* common file under test root path name used for testing */ 65 #define FILE5 TEST_ROOT"/FILE5" /* common file under test root path name used for testing */ 66 #define FILE6 TEST_ROOT"/FILE6" /* common file under test root path name used for testing */ 67 #define DIRA TEST_ROOT"/a" /* common file under test root path name used for testing */ 68 #define DIRB TEST_ROOT"/b" /* common file under test root path name used for testing */ 69 #define DIRC TEST_ROOT"/c" /* common file under test root path name used for testing */ 70 #define DIRD TEST_ROOT"/d" /* common file under test root path name used for testing */ 71 72 #define FILE_IN_DIRA TEST_ROOT"/a/FILE0" /* common file under test root path name used for testing */ 73 #define DIRAB TEST_ROOT"/a/b" /* common file under test root path name used for testing */ 74 #define DIRAC TEST_ROOT"/a/c" /* common file under test root path name used for testing */ 75 76 #define TEST_BUF_SIZE 40 /* 40, common data for test, no special meaning */ 77 #define TEST_SEEK_SIZE 10 /* 10, common data for test, no special meaning */ 78 #define TEST_RW_SIZE 20 /* 20, common data for test, no special meaning */ 79 #define TEST_LOOPUP_TIME 20 /* 100, common data for test, no special meaning */ 80 81 #define ERROR_CONFIG_NFILE_DESCRIPTORS 88888 /* 88888, common data for test, no special meaning */ 82 #define MODIFIED_FILE_SIZE 1024 /* 1024, common data for test, no special meaning */ 83 84 #define TEST_MODE_NORMAL 0666 /* 0666, common data for test, no special meaning */ 85 #define TEST_MODE_HIGH 0777 /* 0777, common data for test, no special meaning */ 86 87 #define POSIX_FS_IS_ERROR (-1) /* -1, common data for test, no special meaning */ 88 #define POSIX_FS_NO_ERROR 0 /* 0, common data for test, no special meaning */ 89 90 #endif /* __POSIX_FS_TEST_H */ 91