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