Changeset View
Changeset View
Standalone View
Standalone View
lib/libbe/be.c
Show All 29 Lines | |||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/mount.h> | #include <sys/mount.h> | ||||
#include <sys/stat.h> | #include <sys/stat.h> | ||||
#include <sys/ucred.h> | #include <sys/ucred.h> | ||||
#include <sys/queue.h> | #include <sys/queue.h> | ||||
#include <sys/zfs_context.h> | #include <sys/zfs_context.h> | ||||
#include <sys/mntent.h> | #include <sys/mntent.h> | ||||
#include <sys/zfs_ioctl.h> | |||||
#include <libzutil.h> | |||||
#include <ctype.h> | #include <ctype.h> | ||||
#include <libgen.h> | #include <libgen.h> | ||||
#include <libzfs_core.h> | #include <libzfs_core.h> | ||||
#include <libzfs_impl.h> | |||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <time.h> | #include <time.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
#include "be.h" | #include "be.h" | ||||
#include "be_impl.h" | #include "be_impl.h" | ||||
▲ Show 20 Lines • Show All 938 Lines • ▼ Show 20 Lines | be_rename(libbe_handle_t *lbh, const char *old, const char *new) | ||||
if (zfs_dataset_exists(lbh->lzh, full_new, ZFS_TYPE_DATASET)) | if (zfs_dataset_exists(lbh->lzh, full_new, ZFS_TYPE_DATASET)) | ||||
return (set_error(lbh, BE_ERR_EXISTS)); | return (set_error(lbh, BE_ERR_EXISTS)); | ||||
if ((zfs_hdl = zfs_open(lbh->lzh, full_old, | if ((zfs_hdl = zfs_open(lbh->lzh, full_old, | ||||
ZFS_TYPE_FILESYSTEM)) == NULL) | ZFS_TYPE_FILESYSTEM)) == NULL) | ||||
return (set_error(lbh, BE_ERR_ZFSOPEN)); | return (set_error(lbh, BE_ERR_ZFSOPEN)); | ||||
/* recurse, nounmount, forceunmount */ | |||||
struct renameflags flags = { | |||||
.nounmount = 1, | |||||
}; | |||||
err = zfs_rename(zfs_hdl, NULL, full_new, flags); | err = zfs_rename(zfs_hdl,full_new, B_FALSE, B_FALSE); | ||||
zfs_close(zfs_hdl); | zfs_close(zfs_hdl); | ||||
if (err != 0) | if (err != 0) | ||||
return (set_error(lbh, BE_ERR_UNKNOWN)); | return (set_error(lbh, BE_ERR_UNKNOWN)); | ||||
return (0); | return (0); | ||||
} | } | ||||
Show All 10 Lines | if ((err = be_snapshot(lbh, bootenv, NULL, true, snap_name)) != 0) | ||||
/* Use the error set by be_snapshot */ | /* Use the error set by be_snapshot */ | ||||
return (err); | return (err); | ||||
be_root_concat(lbh, snap_name, buf); | be_root_concat(lbh, snap_name, buf); | ||||
if ((zfs = zfs_open(lbh->lzh, buf, ZFS_TYPE_DATASET)) == NULL) | if ((zfs = zfs_open(lbh->lzh, buf, ZFS_TYPE_DATASET)) == NULL) | ||||
return (set_error(lbh, BE_ERR_ZFSOPEN)); | return (set_error(lbh, BE_ERR_ZFSOPEN)); | ||||
err = zfs_send_one(zfs, NULL, fd, flags); | err = zfs_send_one(zfs, NULL, fd, &flags, /* redactbook */ NULL); | ||||
zfs_close(zfs); | zfs_close(zfs); | ||||
return (err); | return (err); | ||||
} | } | ||||
int | int | ||||
be_import(libbe_handle_t *lbh, const char *bootenv, int fd) | be_import(libbe_handle_t *lbh, const char *bootenv, int fd) | ||||
▲ Show 20 Lines • Show All 300 Lines • Show Last 20 Lines |