1 /* 2 * 3 * Copyright (c) International Business Machines Corp., 2002 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 13 * the GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 */ 19 20 /* 10/31/2002 Port to LTP robbiew@us.ibm.com */ 21 /* 06/30/2001 Port to Linux nsharoff@us.ibm.com */ 22 23 24 /* 25 * NAME 26 * nftw.h - Header file for nftw.c 27 */ 28 29 30 #ifndef _NFTW_H_ 31 #define _NFTW_H_ 32 33 #include <stdlib.h> 34 #include <ftw.h> 35 #include <unistd.h> 36 #include <fcntl.h> 37 #include <string.h> 38 #include <dirent.h> 39 #include <sys/stat.h> 40 #include <sys/wait.h> 41 #include <sys/types.h> 42 #include <limits.h> 43 #include <errno.h> 44 #include <setjmp.h> 45 #include <stdio.h> 46 #include <linux/limits.h> 47 48 #include "test.h" 49 50 #define STRLEN 512 51 #define MAX_FD 20 52 #define MAXOPENDIRS 1024 /* max opendirs to try to exhaust dir streams */ 53 #define NUM_2_VISIT 4 54 #define RET_VAL 666 55 #define NDIRLISTENTS 100 56 #define ERR_BUF_SIZ 4096 57 #define NFTW "./tmp/data" 58 #define NFTW2 "/tmp/data" 59 #define LINK_CNT 13 60 #define NO_LINK_CNT 7 61 #define DIR 0 62 #define REG 1 63 #define SYM 2 64 65 typedef struct pathdata { 66 char name[PATH_MAX]; 67 mode_t mode; 68 int type; 69 char contents[STRLEN]; 70 } pathdata; 71 72 struct list { 73 char *s; 74 int i; 75 }; 76 77 void fail_exit(void); 78 79 /* These functions are found in test.c */ 80 void test1A(void); 81 void test2A(void); 82 void test3A(void); 83 void test4A(void); 84 void test5A(void); 85 void test6A(void); 86 void test7A(void); 87 void test8A(void); 88 void test9A(void); 89 void test10A(void); 90 void test11A(void); 91 void test12A(void); 92 void test13A(void); 93 void test14A(void); 94 void test15A(void); 95 void test16A(void); 96 void test17A(void); 97 void test18A(void); 98 void test19A(void); 99 void test20A(void); 100 void test21A(void); 101 void test22A(void); 102 void test23A(void); 103 void test24A(void); 104 void test25A(void); 105 void test26A(void); 106 void test27A(void); 107 void test28A(void); 108 void test29A(void); 109 void test30A(void); 110 111 /* These functions are found in test_func.c */ 112 int test_func1(const char *, const struct stat *, int, struct FTW *); 113 int test_func3(const char *, const struct stat *, int, struct FTW *); 114 int test_func4(const char *, const struct stat *, int, struct FTW *); 115 int test_func5(const char *, const struct stat *, int, struct FTW *); 116 int test_func7(const char *, const struct stat *, int, struct FTW *); 117 int test_func8(const char *, const struct stat *, int, struct FTW *); 118 int test_func9(const char *, const struct stat *, int, struct FTW *); 119 int test_func10(const char *, const struct stat *, int, struct FTW *); 120 int test_func11(const char *, const struct stat *, int, struct FTW *); 121 int test_func12(const char *, const struct stat *, int, struct FTW *); 122 int test_func13(const char *, const struct stat *, int, struct FTW *); 123 int test_func14(const char *, const struct stat *, int, struct FTW *); 124 int test_func15(const char *, const struct stat *, int, struct FTW *); 125 int test_func16(const char *, const struct stat *, int, struct FTW *); 126 int test_func17(const char *, const struct stat *, int, struct FTW *); 127 int test_func18(const char *, const struct stat *, int, struct FTW *); 128 int test_func19(const char *, const struct stat *, int, struct FTW *); 129 int test_func20(const char *, const struct stat *, int, struct FTW *); 130 int test_func21(const char *, const struct stat *, int, struct FTW *); 131 int test_func22(const char *, const struct stat *, int, struct FTW *); 132 int test_func23(const char *, const struct stat *, int, struct FTW *); 133 134 /* These functions are found in tools.c */ 135 void cleanup_function(void); 136 void setup_path(void); 137 int nftw_fn(const char *, const struct stat *, int, struct FTW *); 138 char * ftw_mnemonic(int); 139 int getbase(const char *); 140 int getlev(const char *); 141 void do_info(const char *); 142 143 /* These functions are found in lib.c */ 144 void remove_test_ENOTDIR_files(void); 145 void remove_test_ENOENT_files(void); 146 void test_ENAMETOOLONG_path(char *, int (*)(const char *), int); 147 void test_ENAMETOOLONG_name(char *, int (*)(const char *), int); 148 void test_ENOENT_empty(char *, int (*)(const char *), int); 149 void test_ENOTDIR(char *, int (*)(const char *), int); 150 void test_ENOENT_nofile(char *, int (*)(const char *), int); 151 152 #endif /* _NFTW_H_ */ 153