Lines Matching refs:tf
110 struct test_file *tf;
120 tf = malloc(sizeof(struct test_file));
121 if (stat(path, &tf->tf_stat) < 0) {
122 free(tf);
126 tf->tf_size = st.st_size;
127 if (S_ISDIR(tf->tf_stat.st_mode)) {
128 tf->tf_isdir = 1;
129 tf->tf_u.dir = opendir(path);
130 if (!tf->tf_u.dir)
132 *h_return = tf;
135 if (S_ISREG(tf->tf_stat.st_mode)) {
136 tf->tf_isdir = 0;
137 tf->tf_u.fd = open(path, O_RDONLY);
138 if (tf->tf_u.fd < 0)
140 *h_return = tf;
145 free(tf);
152 struct test_file *tf = h;
154 if (tf->tf_isdir)
155 closedir(tf->tf_u.dir);
157 close(tf->tf_u.fd);
158 free(tf);
166 struct test_file *tf = h;
168 return (tf->tf_isdir);
174 struct test_file *tf = h;
177 if (tf->tf_isdir)
179 sz = read(tf->tf_u.fd, dst, size);
190 struct test_file *tf = h;
193 if (!tf->tf_isdir)
196 dp = readdir(tf->tf_u.dir);
216 struct test_file *tf = h;
218 if (tf->tf_isdir)
220 if (lseek(tf->tf_u.fd, offset, whence) < 0)
229 struct test_file *tf = h;
231 *mode_return = tf->tf_stat.st_mode;
232 *uid_return = tf->tf_stat.st_uid;
233 *gid_return = tf->tf_stat.st_gid;
234 *size_return = tf->tf_stat.st_size;