mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 11:18:52 +03:00
OpenZFS restructuring - libzfs
Factor Linux specific functionality out of libzfs. Reviewed-by: Allan Jude <allanjude@freebsd.org> Reviewed-by: Jorgen Lundman <lundman@lundman.net> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Matthew Macy <mmacy@FreeBSD.org> Closes #9377
This commit is contained in:
committed by
Brian Behlendorf
parent
7c5eff9400
commit
73cdcc6323
@@ -48,7 +48,6 @@
|
||||
#include "libzfs_impl.h"
|
||||
|
||||
#define ZDIFF_SNAPDIR "/.zfs/snapshot/"
|
||||
#define ZDIFF_SHARESDIR "/.zfs/shares/"
|
||||
#define ZDIFF_PREFIX "zfs-diff-%d"
|
||||
|
||||
#define ZDIFF_ADDED '+'
|
||||
@@ -56,26 +55,6 @@
|
||||
#define ZDIFF_REMOVED '-'
|
||||
#define ZDIFF_RENAMED 'R'
|
||||
|
||||
typedef struct differ_info {
|
||||
zfs_handle_t *zhp;
|
||||
char *fromsnap;
|
||||
char *frommnt;
|
||||
char *tosnap;
|
||||
char *tomnt;
|
||||
char *ds;
|
||||
char *dsmnt;
|
||||
char *tmpsnap;
|
||||
char errbuf[1024];
|
||||
boolean_t isclone;
|
||||
boolean_t scripted;
|
||||
boolean_t classify;
|
||||
boolean_t timestamped;
|
||||
uint64_t shares;
|
||||
int zerr;
|
||||
int cleanupfd;
|
||||
int outputfd;
|
||||
int datafd;
|
||||
} differ_info_t;
|
||||
|
||||
/*
|
||||
* Given a {dsname, object id}, get the object path
|
||||
@@ -487,25 +466,6 @@ differ(void *arg)
|
||||
return ((void *)0);
|
||||
}
|
||||
|
||||
static int
|
||||
find_shares_object(differ_info_t *di)
|
||||
{
|
||||
char fullpath[MAXPATHLEN];
|
||||
struct stat64 sb = { 0 };
|
||||
|
||||
(void) strlcpy(fullpath, di->dsmnt, MAXPATHLEN);
|
||||
(void) strlcat(fullpath, ZDIFF_SHARESDIR, MAXPATHLEN);
|
||||
|
||||
if (stat64(fullpath, &sb) != 0) {
|
||||
(void) snprintf(di->errbuf, sizeof (di->errbuf),
|
||||
dgettext(TEXT_DOMAIN, "Cannot stat %s"), fullpath);
|
||||
return (zfs_error(di->zhp->zfs_hdl, EZFS_DIFF, di->errbuf));
|
||||
}
|
||||
|
||||
di->shares = (uint64_t)sb.st_ino;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
make_temp_snapshot(differ_info_t *di)
|
||||
{
|
||||
@@ -737,7 +697,7 @@ setup_differ_info(zfs_handle_t *zhp, const char *fromsnap,
|
||||
{
|
||||
di->zhp = zhp;
|
||||
|
||||
di->cleanupfd = open(ZFS_DEV, O_RDWR);
|
||||
di->cleanupfd = open(ZFS_DEV, O_RDWR|O_EXCL);
|
||||
VERIFY(di->cleanupfd >= 0);
|
||||
|
||||
if (get_snapshot_names(di, fromsnap, tosnap) != 0)
|
||||
|
||||
Reference in New Issue
Block a user