Lines Matching refs:tmpf

91 nfs_init_tmpfile(const char *prefix, const char *mdir, struct tmpfile *tmpf)  in nfs_init_tmpfile()  argument
102 strlcpy(tmpf->name, prefix, sizeof (tmpf->name)); in nfs_init_tmpfile()
103 strlcat(tmpf->name, ".XXXXXXXX", sizeof (tmpf->name)); in nfs_init_tmpfile()
105 int fd = mkostemp(tmpf->name, O_CLOEXEC); in nfs_init_tmpfile()
112 tmpf->fp = fdopen(fd, "w+"); in nfs_init_tmpfile()
113 if (tmpf->fp == NULL) { in nfs_init_tmpfile()
124 nfs_abort_tmpfile(struct tmpfile *tmpf) in nfs_abort_tmpfile() argument
126 unlink(tmpf->name); in nfs_abort_tmpfile()
127 fclose(tmpf->fp); in nfs_abort_tmpfile()
131 nfs_fini_tmpfile(const char *exports, struct tmpfile *tmpf) in nfs_fini_tmpfile() argument
133 if (fflush(tmpf->fp) != 0) { in nfs_fini_tmpfile()
136 nfs_abort_tmpfile(tmpf); in nfs_fini_tmpfile()
140 if (rename(tmpf->name, exports) == -1) { in nfs_fini_tmpfile()
142 tmpf->name, exports, zfs_strerror(errno)); in nfs_fini_tmpfile()
143 nfs_abort_tmpfile(tmpf); in nfs_fini_tmpfile()
147 (void) fchmod(fileno(tmpf->fp), 0644); in nfs_fini_tmpfile()
148 fclose(tmpf->fp); in nfs_fini_tmpfile()
260 struct tmpfile tmpf; in nfs_toggle_share() local
262 if (!nfs_init_tmpfile(exports, expdir, &tmpf)) in nfs_toggle_share()
267 nfs_abort_tmpfile(&tmpf); in nfs_toggle_share()
271 error = nfs_copy_entries(tmpf.fp, exports, impl_share->sa_mountpoint); in nfs_toggle_share()
275 error = cbk(impl_share, tmpf.fp); in nfs_toggle_share()
279 error = nfs_fini_tmpfile(exports, &tmpf); in nfs_toggle_share()
284 nfs_abort_tmpfile(&tmpf); in nfs_toggle_share()