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