Lines Matching refs:cf
165 struct cb_file *cf;
175 cf = malloc(sizeof(struct cb_file));
176 if (stat(path, &cf->cf_stat) < 0) {
177 free(cf);
181 cf->cf_size = cf->cf_stat.st_size;
182 if (S_ISDIR(cf->cf_stat.st_mode)) {
183 cf->cf_isdir = 1;
184 cf->cf_u.dir = opendir(path);
185 if (!cf->cf_u.dir)
187 *hp = cf;
190 if (S_ISREG(cf->cf_stat.st_mode)) {
191 cf->cf_isdir = 0;
192 cf->cf_u.fd = open(path, O_RDONLY);
193 if (cf->cf_u.fd < 0)
195 *hp = cf;
200 free(cf);
207 struct cb_file *cf = h;
209 if (cf->cf_isdir)
210 closedir(cf->cf_u.dir);
212 close(cf->cf_u.fd);
213 free(cf);
221 struct cb_file *cf = h;
223 return (cf->cf_isdir);
229 struct cb_file *cf = h;
232 if (cf->cf_isdir)
234 sz = read(cf->cf_u.fd, buf, size);
245 struct cb_file *cf = h;
248 if (!cf->cf_isdir)
251 dp = readdir(cf->cf_u.dir);
271 struct cb_file *cf = h;
273 if (cf->cf_isdir)
275 if (lseek(cf->cf_u.fd, offset, whence) < 0)
283 struct cb_file *cf = h;
285 *mode = cf->cf_stat.st_mode;
286 *uid = cf->cf_stat.st_uid;
287 *gid = cf->cf_stat.st_gid;
288 *size = cf->cf_stat.st_size;