Lines Matching refs:f
86 struct open_file *f; in fd2open_file() local
88 TAILQ_FOREACH(f, &files, f_link) { in fd2open_file()
90 if (f->f_id == fd) in fd2open_file()
95 if (f->f_flags == 0) in fd2open_file()
98 return (f); in fd2open_file()
104 struct open_file *f, *last; in o_gethandle() local
107 f = fd2open_file(-1); in o_gethandle()
108 if (f != NULL) { in o_gethandle()
109 *ptr = f; in o_gethandle()
110 return (f->f_id); in o_gethandle()
114 f = calloc(1, sizeof (*f)); in o_gethandle()
115 if (f == NULL) in o_gethandle()
120 f->f_id = last->f_id + 1; in o_gethandle()
121 TAILQ_INSERT_TAIL(&files, f, f_link); in o_gethandle()
123 *ptr = f; in o_gethandle()
124 return (f->f_id); in o_gethandle()
128 o_rainit(struct open_file *f) in o_rainit() argument
130 f->f_rabuf = malloc(SOPEN_RASIZE); in o_rainit()
131 f->f_ralen = 0; in o_rainit()
132 f->f_raoffset = 0; in o_rainit()
139 struct open_file *f; in open() local
145 if ((fd = o_gethandle(&f)) == -1) { in open()
150 f->f_flags = mode + 1; in open()
151 f->f_dev = NULL; in open()
152 f->f_ops = NULL; in open()
153 f->f_offset = 0; in open()
154 f->f_devdata = NULL; in open()
159 error = (fs->fo_open)(fname, f); in open()
165 error = devopen(f, fname, &file); in open()
167 (((f->f_flags & F_NODEV) == 0) && f->f_dev == NULL)) in open()
172 f->f_flags |= F_RAW; in open()
173 f->f_rabuf = NULL; in open()
182 error = (fs->fo_open)(file, f); in open()
190 if ((f->f_flags & F_NODEV) == 0 && f->f_dev != NULL) in open()
191 f->f_dev->dv_close(f); in open()
193 devclose(f); in open()
196 f->f_flags = 0; in open()
202 f->f_ops = fs; in open()
203 o_rainit(f); in open()