The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/contrib/openzfs/cmd/zstream/zstream_token.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * CDDL HEADER START
    3  *
    4  * The contents of this file are subject to the terms of the
    5  * Common Development and Distribution License (the "License").
    6  * You may not use this file except in compliance with the License.
    7  *
    8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
    9  * or https://opensource.org/licenses/CDDL-1.0.
   10  * See the License for the specific language governing permissions
   11  * and limitations under the License.
   12  *
   13  * When distributing Covered Code, include this CDDL HEADER in each
   14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
   15  * If applicable, add the following below this CDDL HEADER, with the
   16  * fields enclosed by brackets "[]" replaced with your own identifying
   17  * information: Portions Copyright [yyyy] [name of copyright owner]
   18  *
   19  * CDDL HEADER END
   20  */
   21 
   22 /*
   23  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
   24  * Use is subject to license terms.
   25  *
   26  * Portions Copyright 2012 Martin Matuska <martin@matuska.org>
   27  */
   28 
   29 /*
   30  * Copyright (c) 2020 by Datto Inc. All rights reserved.
   31  */
   32 
   33 #include <ctype.h>
   34 #include <libnvpair.h>
   35 #include <stdio.h>
   36 #include <stdlib.h>
   37 #include <string.h>
   38 #include <unistd.h>
   39 #include <stddef.h>
   40 
   41 #include <libzfs.h>
   42 #include <libzfs_core.h>
   43 
   44 #include <sys/dmu.h>
   45 #include <sys/zfs_ioctl.h>
   46 #include "zstream.h"
   47 
   48 int
   49 zstream_do_token(int argc, char *argv[])
   50 {
   51         char *resume_token = NULL;
   52         libzfs_handle_t *hdl;
   53 
   54         if (argc < 2) {
   55                 (void) fprintf(stderr, "Need to pass the resume token\n");
   56                 zstream_usage();
   57         }
   58 
   59         resume_token = argv[1];
   60 
   61         if ((hdl = libzfs_init()) == NULL) {
   62                 (void) fprintf(stderr, "%s\n", libzfs_error_init(errno));
   63                 return (1);
   64         }
   65 
   66         nvlist_t *resume_nvl =
   67             zfs_send_resume_token_to_nvlist(hdl, resume_token);
   68 
   69         if (resume_nvl == NULL) {
   70                 (void) fprintf(stderr,
   71                     "Unable to parse resume token: %s\n",
   72                     libzfs_error_description(hdl));
   73                 libzfs_fini(hdl);
   74                 return (1);
   75         }
   76 
   77         dump_nvlist(resume_nvl, 5);
   78         nvlist_free(resume_nvl);
   79 
   80         libzfs_fini(hdl);
   81         return (0);
   82 }

Cache object: fcd8201e9ea04a5bbcb381ca6041166f


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.