libshare: nfs: commonify nfs_{init,fini}_tmpfile(), nfs_disable_share()

Also open the temp file cloexec

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Wilson <gwilson@delphix.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11886
This commit is contained in:
наб
2021-04-11 19:42:07 +02:00
committed by Brian Behlendorf
parent a3d387b31d
commit 8357bbff1f
5 changed files with 101 additions and 132 deletions
+9
View File
@@ -24,9 +24,18 @@
* Copyright (c) 2011 Gunnar Beutner
*/
#include "libshare_impl.h"
#define FILE_HEADER "# !!! DO NOT EDIT THIS FILE MANUALLY !!!\n\n"
void libshare_nfs_init(void);
int nfs_exports_lock(const char *name);
void nfs_exports_unlock(const char *name);
char *nfs_init_tmpfile(const char *prefix, const char *mdir);
int nfs_fini_tmpfile(const char *exports, char *tmpfile);
int nfs_copy_entries(char *filename, const char *mountpoint);
int nfs_disable_share_impl(const char *lockfile, const char *exports,
const char *expdir, sa_share_impl_t impl_share);