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