Lines Matching refs:tf
109 struct test_file *tf; in test_open() local
119 tf = malloc(sizeof(struct test_file)); in test_open()
120 if (stat(path, &tf->tf_stat) < 0) { in test_open()
121 free(tf); in test_open()
125 tf->tf_size = st.st_size; in test_open()
126 if (S_ISDIR(tf->tf_stat.st_mode)) { in test_open()
127 tf->tf_isdir = 1; in test_open()
128 tf->tf_u.dir = opendir(path); in test_open()
129 if (!tf->tf_u.dir) in test_open()
131 *h_return = tf; in test_open()
134 if (S_ISREG(tf->tf_stat.st_mode)) { in test_open()
135 tf->tf_isdir = 0; in test_open()
136 tf->tf_u.fd = open(path, O_RDONLY); in test_open()
137 if (tf->tf_u.fd < 0) in test_open()
139 *h_return = tf; in test_open()
144 free(tf); in test_open()
151 struct test_file *tf = h; in test_close() local
153 if (tf->tf_isdir) in test_close()
154 closedir(tf->tf_u.dir); in test_close()
156 close(tf->tf_u.fd); in test_close()
157 free(tf); in test_close()
165 struct test_file *tf = h; in test_isdir() local
167 return (tf->tf_isdir); in test_isdir()
173 struct test_file *tf = h; in test_read() local
176 if (tf->tf_isdir) in test_read()
178 sz = read(tf->tf_u.fd, dst, size); in test_read()
189 struct test_file *tf = h; in test_readdir() local
192 if (!tf->tf_isdir) in test_readdir()
195 dp = readdir(tf->tf_u.dir); in test_readdir()
215 struct test_file *tf = h; in test_seek() local
217 if (tf->tf_isdir) in test_seek()
219 if (lseek(tf->tf_u.fd, offset, whence) < 0) in test_seek()
227 struct test_file *tf = h; in test_stat() local
232 stp->st_mode = tf->tf_stat.st_mode; in test_stat()
233 stp->st_uid = tf->tf_stat.st_uid; in test_stat()
234 stp->st_gid = tf->tf_stat.st_gid; in test_stat()
235 stp->st_size = tf->tf_stat.st_size; in test_stat()
236 stp->st_ino = tf->tf_stat.st_ino; in test_stat()
237 stp->st_dev = tf->tf_stat.st_dev; in test_stat()
238 stp->st_mtime = tf->tf_stat.st_mtime; in test_stat()