Lines Matching refs:fp

43  *	fp = zonecfg_open_scratch("", B_TRUE);
44 * zonecfg_lock_scratch(fp);
45 * if (zonecfg_find_scratch(fp, zonename, altroot, NULL, 0) == 0) {
49 * zonecfg_add_scratch(fp, zonename, kernname, altroot);
50 * zonecfg_close_scratch(fp);
51 * fp = zonecfg_open_scratch(zoneroot, B_TRUE);
52 * ftruncate(fileno(fp), 0);
53 * zonecfg_add_scratch(fp, zonename, kernname, "/");
54 * zonecfg_close_scratch(fp);
88 FILE *fp;
122 if ((fp = fdopen(fd, "r+")) == NULL)
124 return (fp);
134 zonecfg_lock_scratch(FILE *fp)
136 if (fflush(fp) != 0)
138 return (lock_op(fileno(fp), F_WRLCK));
142 zonecfg_close_scratch(FILE *fp)
144 (void) fclose(fp);
148 zonecfg_get_scratch(FILE *fp, char *zonename, size_t namelen, char *kernname,
156 if (fgets(line, sizeof (line), fp) == NULL)
183 zonecfg_find_scratch(FILE *fp, const char *zonename, const char *altroot,
189 rewind(fp);
190 while (zonecfg_get_scratch(fp, zone, sizeof (zone), kernzone, kernlen,
199 zonecfg_reverse_scratch(FILE *fp, const char *kernzone, char *zonename,
204 rewind(fp);
205 while (zonecfg_get_scratch(fp, zonename, namelen, kzone,
214 zonecfg_add_scratch(FILE *fp, const char *zonename, const char *kernzone,
217 if (fseek(fp, 0, SEEK_END) == -1)
219 if (fprintf(fp, "%s %s %s\n", zonename, kernzone, altroot) == EOF)
221 if (fflush(fp) != 0)
227 zonecfg_delete_scratch(FILE *fp, const char *kernzone)
240 rewind(fp);
244 if (zonecfg_get_scratch(fp, NULL, 0, kzone, sizeof (kzone),
247 roffs = ftell(fp);
249 while (zonecfg_get_scratch(fp, zone, sizeof (zone), kzone,
251 roffs = ftell(fp);
252 if (fseek(fp, woffs, SEEK_SET) == -1)
254 if (fprintf(fp, "%s %s %s\n", zone, kzone, aroot) == EOF)
256 woffs = ftell(fp);
257 if (fseek(fp, roffs, SEEK_SET) == -1)
260 (void) ftruncate(fileno(fp), woffs);