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 * nftw64.h - Header file for nftw64.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 47 #include "test.h" 48 49 #define STRLEN 512 50 #define MAX_FD 20 51 #define MAXOPENDIRS 1024 /* max opendirs to try to exhaust dir streams */ 52 #define NUM_2_VISIT 4 53 #define RET_VAL 666 54 #define NDIRLISTENTS 100 55 #define ERR_BUF_SIZ 4096 56 #define NFTW "./tmp/data" 57 #define NFTW2 "/tmp/data" 58 #define LINK_CNT 13 59 #define NO_LINK_CNT 7 60 #define DIR 0 61 #define REG 1 62 #define SYM 2 63 64 typedef struct pathdata { 65 char name[PATH_MAX]; 66 mode_t mode; 67 int type; 68 char contents[STRLEN]; 69 } pathdata; 70 71 struct list { 72 char *s; 73 int i; 74 }; 75 76 extern void fail_exit(void); 77 78 /* These functions are found in test.c */ 79 extern void test1A(void); 80 extern void test2A(void); 81 extern void test3A(void); 82 extern void test4A(void); 83 extern void test5A(void); 84 extern void test6A(void); 85 extern void test7A(void); 86 extern void test8A(void); 87 extern void test9A(void); 88 extern void test10A(void); 89 extern void test11A(void); 90 extern void test12A(void); 91 extern void test13A(void); 92 extern void test14A(void); 93 extern void test15A(void); 94 extern void test16A(void); 95 extern void test17A(void); 96 extern void test18A(void); 97 extern void test19A(void); 98 extern void test20A(void); 99 extern void test21A(void); 100 extern void test22A(void); 101 extern void test23A(void); 102 extern void test24A(void); 103 extern void test25A(void); 104 extern void test26A(void); 105 extern void test27A(void); 106 extern void test28A(void); 107 extern void test29A(void); 108 extern void test30A(void); 109 110 /* These functions are found in test_func.c */ 111 extern int test_func1(const char *, const struct stat64 *, int, struct FTW *); 112 extern int test_func3(const char *, const struct stat64 *, int, struct FTW *); 113 extern int test_func4(const char *, const struct stat64 *, int, struct FTW *); 114 extern int test_func5(const char *, const struct stat64 *, int, struct FTW *); 115 extern int test_func7(const char *, const struct stat64 *, int, struct FTW *); 116 extern int test_func8(const char *, const struct stat64 *, int, struct FTW *); 117 extern int test_func9(const char *, const struct stat64 *, int, struct FTW *); 118 extern int test_func10(const char *, const struct stat64 *, int, struct FTW *); 119 extern int test_func11(const char *, const struct stat64 *, int, struct FTW *); 120 extern int test_func12(const char *, const struct stat64 *, int, struct FTW *); 121 extern int test_func13(const char *, const struct stat64 *, int, struct FTW *); 122 extern int test_func14(const char *, const struct stat64 *, int, struct FTW *); 123 extern int test_func15(const char *, const struct stat64 *, int, struct FTW *); 124 extern int test_func16(const char *, const struct stat64 *, int, struct FTW *); 125 extern int test_func17(const char *, const struct stat64 *, int, struct FTW *); 126 extern int test_func18(const char *, const struct stat64 *, int, struct FTW *); 127 extern int test_func19(const char *, const struct stat64 *, int, struct FTW *); 128 extern int test_func20(const char *, const struct stat64 *, int, struct FTW *); 129 extern int test_func21(const char *, const struct stat64 *, int, struct FTW *); 130 extern int test_func22(const char *, const struct stat64 *, int, struct FTW *); 131 extern int test_func23(const char *, const struct stat64 *, int, struct FTW *); 132 133 /* These functions are found in tools.c */ 134 extern void cleanup_function(void); 135 extern void setup_path(void); 136 extern int nftw64_fn(const char *, const struct stat64 *, int, struct FTW *); 137 extern char * ftw_mnemonic(int); 138 extern int getbase(const char *); 139 extern int getlev(const char *); 140 extern void do_info(const char *); 141 142 /* These functions are found in lib.c */ 143 extern void remove_test_ENOTDIR_files(void); 144 extern void remove_test_ENOENT_files(void); 145 extern void test_ENAMETOOLONG_path(char *, int (*)(const char *), int); 146 extern void test_ENAMETOOLONG_name(char *, int (*)(const char *), int); 147 extern void test_ENOENT_empty(char *, int (*)(const char *), int); 148 extern void test_ENOTDIR(char *, int (*)(const char *), int); 149 extern void test_ENOENT_nofile(char *, int (*)(const char *), int); 150 151 152 #endif /* _NFTW_H_ */ 153