return (gettext("\tlist [-rH][-d max] "
"[-o property[,...]] [-t type[,...]] [-s property] ...\n"
"\t [-S property] ... "
- "[filesystem|volume|snapshot] ...\n"));
+ "[filesystem|volume|snapshot|snap] ...\n"));
case HELP_MOUNT:
return (gettext("\tmount\n"
"\tmount [-vO] [-o opts] <-a | filesystem>\n"));
case HELP_SHARE:
return (gettext("\tshare <-a | filesystem>\n"));
case HELP_SNAPSHOT:
- return (gettext("\tsnapshot [-r] [-o property=value] ... "
+ return (gettext("\tsnapshot|snap [-r] [-o property=value] ... "
"<filesystem@snapname|volume@snapname>\n"));
case HELP_UNMOUNT:
return (gettext("\tunmount [-f] "
zfs_handle_t *zhp = NULL;
boolean_t parents = B_FALSE;
nvlist_t *props;
- int ret;
+ int ret = 0;
int c;
if (nvlist_alloc(&props, NV_UNIQUE_NAME, 0) != 0)
* named snapshot may not exist. Go straight to libzfs.
*/
if (cb.cb_recurse && (cp = strchr(argv[0], '@'))) {
- int ret;
+ int ret = 0;
*cp = '\0';
if ((zhp = zfs_open(g_zfs, argv[0], ZFS_TYPE_DATASET)) == NULL)
zprop_get_cbdata_t cb = { 0 };
int i, c, flags = ZFS_ITER_ARGS_CAN_BE_PATHS;
char *value, *fields;
- int ret;
+ int ret = 0;
int limit = 0;
zprop_list_t fake_name = { 0 };
zfs_prop_t prop;
inherit_cbdata_t cb = { 0 };
char *propname;
- int ret;
+ int ret = 0;
int flags = 0;
boolean_t received = B_FALSE;
{
boolean_t all = B_FALSE;
boolean_t showversions = B_FALSE;
- int ret;
+ int ret = 0;
upgrade_cbdata_t cb = { 0 };
signed char c;
int flags = ZFS_ITER_ARGS_CAN_BE_PATHS;
char sid[ZFS_MAXNAMELEN+32];
uid_t id;
uint64_t classes;
- int err;
+ int err = 0;
directory_error_t e;
(void) snprintf(sid, sizeof (sid), "%s-%u", domain, rid);
first = B_FALSE;
}
- if (pl->pl_prop != ZPROP_INVAL) {
+ if (pl->pl_prop == ZFS_PROP_NAME) {
+ (void) strlcpy(property, zfs_get_name(zhp),
+ sizeof(property));
+ propstr = property;
+ right_justify = zfs_prop_align_right(pl->pl_prop);
+ } else if (pl->pl_prop != ZPROP_INVAL) {
if (zfs_prop_get(zhp, pl->pl_prop, property,
sizeof (property), NULL, NULL, 0, B_FALSE) != 0)
propstr = "-";
list_cbdata_t cb = { 0 };
char *value;
int limit = 0;
- int ret;
+ int ret = 0;
zfs_sort_column_t *sortcol = NULL;
int flags = ZFS_ITER_PROP_LISTSNAPS | ZFS_ITER_ARGS_CAN_BE_PATHS;
flags &= ~ZFS_ITER_PROP_LISTSNAPS;
while (*optarg != '\0') {
static char *type_subopts[] = { "filesystem",
- "volume", "snapshot", "all", NULL };
+ "volume", "snapshot", "snap", "all", NULL };
switch (getsubopt(&optarg, type_subopts,
&value)) {
types |= ZFS_TYPE_VOLUME;
break;
case 2:
+ case 3:
types |= ZFS_TYPE_SNAPSHOT;
break;
- case 3:
+ case 4:
types = ZFS_TYPE_DATASET;
break;
fields = default_fields;
/*
+ * If we are only going to list snapshot names and sort by name,
+ * then we can use faster version.
+ */
+ if (strcmp(fields, "name") == 0 && zfs_sort_only_by_name(sortcol))
+ flags |= ZFS_ITER_SIMPLE;
+
+ /*
* If "-o space" and no types were specified, don't display snapshots.
*/
if (strcmp(fields, "space") == 0 && types_specified == B_FALSE)
{
zfs_handle_t *zhp;
int c;
- int ret;
+ int ret = 0;
boolean_t recurse = B_FALSE;
boolean_t parents = B_FALSE;
zfs_do_promote(int argc, char **argv)
{
zfs_handle_t *zhp;
- int ret;
+ int ret = 0;
/* check options */
if (argc > 1 && argv[1][0] == '-') {
static int
zfs_do_rollback(int argc, char **argv)
{
- int ret;
+ int ret = 0;
int c;
boolean_t force = B_FALSE;
rollback_cbdata_t cb = { 0 };
zfs_do_set(int argc, char **argv)
{
set_cbdata_t cb;
- int ret;
+ int ret = 0;
/* check for options */
if (argc > 1 && argv[1][0] == '-') {
zfs_do_snapshot(int argc, char **argv)
{
boolean_t recursive = B_FALSE;
- int ret;
+ int ret = 0;
signed char c;
nvlist_t *props;
holds_cbdata_t cb = { 0 };
int limit = 0;
- int ret;
+ int ret = 0;
int flags = 0;
/* check options */
unshare_unmount_path(int op, char *path, int flags, boolean_t is_manual)
{
zfs_handle_t *zhp;
- int ret;
+ int ret = 0;
struct stat64 statbuf;
struct extmnttab entry;
const char *cmdname = (op == OP_SHARE) ? "unshare" : "unmount";
char *tosnap = NULL;
char *fromsnap = NULL;
char *atp, *copy;
- int err;
+ int err = 0;
int c;
while ((c = getopt(argc, argv, "FHt")) != -1) {
int
main(int argc, char **argv)
{
- int ret;
+ int ret = 0;
int i = 0;
char *cmdname;
cmdname = "receive";
/*
+ * The 'snap' command is an alias for 'snapshot'
+ */
+ if (strcmp(cmdname, "snap") == 0)
+ cmdname = "snapshot";
+
+ /*
* Special case '-?'
*/
if ((strcmp(cmdname, "-?") == 0) ||