Lines Matching refs:tf
109 struct test_file *tf;
119 tf = malloc(sizeof(struct test_file));
120 if (stat(path, &tf->tf_stat) < 0) {
121 free(tf);
125 tf->tf_size = st.st_size;
126 if (S_ISDIR(tf->tf_stat.st_mode)) {
127 tf->tf_isdir = 1;
128 tf->tf_u.dir = opendir(path);
129 if (!tf->tf_u.dir)
131 *h_return = tf;
134 if (S_ISREG(tf->tf_stat.st_mode)) {
135 tf->tf_isdir = 0;
136 tf->tf_u.fd = open(path, O_RDONLY);
137 if (tf->tf_u.fd < 0)
139 *h_return = tf;
144 free(tf);
151 struct test_file *tf = h;
153 if (tf->tf_isdir)
154 closedir(tf->tf_u.dir);
156 close(tf->tf_u.fd);
157 free(tf);
165 struct test_file *tf = h;
167 return (tf->tf_isdir);
173 struct test_file *tf = h;
176 if (tf->tf_isdir)
178 sz = read(tf->tf_u.fd, dst, size);
189 struct test_file *tf = h;
192 if (!tf->tf_isdir)
195 dp = readdir(tf->tf_u.dir);
215 struct test_file *tf = h;
217 if (tf->tf_isdir)
219 if (lseek(tf->tf_u.fd, offset, whence) < 0)
228 struct test_file *tf = h;
230 *mode_return = tf->tf_stat.st_mode;
231 *uid_return = tf->tf_stat.st_uid;
232 *gid_return = tf->tf_stat.st_gid;
233 *size_return = tf->tf_stat.st_size;