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/module/os/freebsd/zfs/zfs_ioctl_compat.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  * Copyright (c) 2020 iXsystems, Inc.
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  *
   14  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
   15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
   18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   24  * SUCH DAMAGE.
   25  *
   26  */
   27 
   28 #include <sys/cdefs.h>
   29 __FBSDID("$FreeBSD$");
   30 
   31 #include <sys/types.h>
   32 #include <sys/param.h>
   33 #include <sys/conf.h>
   34 #include <sys/kernel.h>
   35 #include <sys/lock.h>
   36 #include <sys/malloc.h>
   37 #include <sys/mutex.h>
   38 #include <sys/errno.h>
   39 #include <sys/cmn_err.h>
   40 #include <sys/zfs_ioctl_compat.h>
   41 
   42 #ifdef ZFS_LEGACY_SUPPORT
   43 enum zfs_ioc_legacy {
   44         ZFS_IOC_LEGACY_NONE =   -1,
   45         ZFS_IOC_LEGACY_FIRST =  0,
   46         ZFS_LEGACY_IOC = ZFS_IOC_LEGACY_FIRST,
   47         ZFS_IOC_LEGACY_POOL_CREATE = ZFS_IOC_LEGACY_FIRST,
   48         ZFS_IOC_LEGACY_POOL_DESTROY,
   49         ZFS_IOC_LEGACY_POOL_IMPORT,
   50         ZFS_IOC_LEGACY_POOL_EXPORT,
   51         ZFS_IOC_LEGACY_POOL_CONFIGS,
   52         ZFS_IOC_LEGACY_POOL_STATS,
   53         ZFS_IOC_LEGACY_POOL_TRYIMPORT,
   54         ZFS_IOC_LEGACY_POOL_SCAN,
   55         ZFS_IOC_LEGACY_POOL_FREEZE,
   56         ZFS_IOC_LEGACY_POOL_UPGRADE,
   57         ZFS_IOC_LEGACY_POOL_GET_HISTORY,
   58         ZFS_IOC_LEGACY_VDEV_ADD,
   59         ZFS_IOC_LEGACY_VDEV_REMOVE,
   60         ZFS_IOC_LEGACY_VDEV_SET_STATE,
   61         ZFS_IOC_LEGACY_VDEV_ATTACH,
   62         ZFS_IOC_LEGACY_VDEV_DETACH,
   63         ZFS_IOC_LEGACY_VDEV_SETPATH,
   64         ZFS_IOC_LEGACY_VDEV_SETFRU,
   65         ZFS_IOC_LEGACY_OBJSET_STATS,
   66         ZFS_IOC_LEGACY_OBJSET_ZPLPROPS,
   67         ZFS_IOC_LEGACY_DATASET_LIST_NEXT,
   68         ZFS_IOC_LEGACY_SNAPSHOT_LIST_NEXT,
   69         ZFS_IOC_LEGACY_SET_PROP,
   70         ZFS_IOC_LEGACY_CREATE,
   71         ZFS_IOC_LEGACY_DESTROY,
   72         ZFS_IOC_LEGACY_ROLLBACK,
   73         ZFS_IOC_LEGACY_RENAME,
   74         ZFS_IOC_LEGACY_RECV,
   75         ZFS_IOC_LEGACY_SEND,
   76         ZFS_IOC_LEGACY_INJECT_FAULT,
   77         ZFS_IOC_LEGACY_CLEAR_FAULT,
   78         ZFS_IOC_LEGACY_INJECT_LIST_NEXT,
   79         ZFS_IOC_LEGACY_ERROR_LOG,
   80         ZFS_IOC_LEGACY_CLEAR,
   81         ZFS_IOC_LEGACY_PROMOTE,
   82         ZFS_IOC_LEGACY_DESTROY_SNAPS,
   83         ZFS_IOC_LEGACY_SNAPSHOT,
   84         ZFS_IOC_LEGACY_DSOBJ_TO_DSNAME,
   85         ZFS_IOC_LEGACY_OBJ_TO_PATH,
   86         ZFS_IOC_LEGACY_POOL_SET_PROPS,
   87         ZFS_IOC_LEGACY_POOL_GET_PROPS,
   88         ZFS_IOC_LEGACY_SET_FSACL,
   89         ZFS_IOC_LEGACY_GET_FSACL,
   90         ZFS_IOC_LEGACY_SHARE,
   91         ZFS_IOC_LEGACY_INHERIT_PROP,
   92         ZFS_IOC_LEGACY_SMB_ACL,
   93         ZFS_IOC_LEGACY_USERSPACE_ONE,
   94         ZFS_IOC_LEGACY_USERSPACE_MANY,
   95         ZFS_IOC_LEGACY_USERSPACE_UPGRADE,
   96         ZFS_IOC_LEGACY_HOLD,
   97         ZFS_IOC_LEGACY_RELEASE,
   98         ZFS_IOC_LEGACY_GET_HOLDS,
   99         ZFS_IOC_LEGACY_OBJSET_RECVD_PROPS,
  100         ZFS_IOC_LEGACY_VDEV_SPLIT,
  101         ZFS_IOC_LEGACY_NEXT_OBJ,
  102         ZFS_IOC_LEGACY_DIFF,
  103         ZFS_IOC_LEGACY_TMP_SNAPSHOT,
  104         ZFS_IOC_LEGACY_OBJ_TO_STATS,
  105         ZFS_IOC_LEGACY_JAIL,
  106         ZFS_IOC_LEGACY_UNJAIL,
  107         ZFS_IOC_LEGACY_POOL_REGUID,
  108         ZFS_IOC_LEGACY_SPACE_WRITTEN,
  109         ZFS_IOC_LEGACY_SPACE_SNAPS,
  110         ZFS_IOC_LEGACY_SEND_PROGRESS,
  111         ZFS_IOC_LEGACY_POOL_REOPEN,
  112         ZFS_IOC_LEGACY_LOG_HISTORY,
  113         ZFS_IOC_LEGACY_SEND_NEW,
  114         ZFS_IOC_LEGACY_SEND_SPACE,
  115         ZFS_IOC_LEGACY_CLONE,
  116         ZFS_IOC_LEGACY_BOOKMARK,
  117         ZFS_IOC_LEGACY_GET_BOOKMARKS,
  118         ZFS_IOC_LEGACY_DESTROY_BOOKMARKS,
  119         ZFS_IOC_LEGACY_NEXTBOOT,
  120         ZFS_IOC_LEGACY_CHANNEL_PROGRAM,
  121         ZFS_IOC_LEGACY_REMAP,
  122         ZFS_IOC_LEGACY_POOL_CHECKPOINT,
  123         ZFS_IOC_LEGACY_POOL_DISCARD_CHECKPOINT,
  124         ZFS_IOC_LEGACY_POOL_INITIALIZE,
  125         ZFS_IOC_LEGACY_POOL_SYNC,
  126         ZFS_IOC_LEGACY_LAST
  127 };
  128 
  129 static unsigned long zfs_ioctl_legacy_to_ozfs_[] = {
  130         ZFS_IOC_POOL_CREATE,                    /* 0x00 */
  131         ZFS_IOC_POOL_DESTROY,                   /* 0x01 */
  132         ZFS_IOC_POOL_IMPORT,                    /* 0x02 */
  133         ZFS_IOC_POOL_EXPORT,                    /* 0x03 */
  134         ZFS_IOC_POOL_CONFIGS,                   /* 0x04 */
  135         ZFS_IOC_POOL_STATS,                     /* 0x05 */
  136         ZFS_IOC_POOL_TRYIMPORT,                 /* 0x06 */
  137         ZFS_IOC_POOL_SCAN,                      /* 0x07 */
  138         ZFS_IOC_POOL_FREEZE,                    /* 0x08 */
  139         ZFS_IOC_POOL_UPGRADE,                   /* 0x09 */
  140         ZFS_IOC_POOL_GET_HISTORY,               /* 0x0a */
  141         ZFS_IOC_VDEV_ADD,                       /* 0x0b */
  142         ZFS_IOC_VDEV_REMOVE,                    /* 0x0c */
  143         ZFS_IOC_VDEV_SET_STATE,                 /* 0x0d */
  144         ZFS_IOC_VDEV_ATTACH,                    /* 0x0e */
  145         ZFS_IOC_VDEV_DETACH,                    /* 0x0f */
  146         ZFS_IOC_VDEV_SETPATH,                   /* 0x10 */
  147         ZFS_IOC_VDEV_SETFRU,                    /* 0x11 */
  148         ZFS_IOC_OBJSET_STATS,                   /* 0x12 */
  149         ZFS_IOC_OBJSET_ZPLPROPS,                /* 0x13 */
  150         ZFS_IOC_DATASET_LIST_NEXT,              /* 0x14 */
  151         ZFS_IOC_SNAPSHOT_LIST_NEXT,             /* 0x15 */
  152         ZFS_IOC_SET_PROP,                       /* 0x16 */
  153         ZFS_IOC_CREATE,                         /* 0x17 */
  154         ZFS_IOC_DESTROY,                        /* 0x18 */
  155         ZFS_IOC_ROLLBACK,                       /* 0x19 */
  156         ZFS_IOC_RENAME,                         /* 0x1a */
  157         ZFS_IOC_RECV,                           /* 0x1b */
  158         ZFS_IOC_SEND,                           /* 0x1c */
  159         ZFS_IOC_INJECT_FAULT,                   /* 0x1d */
  160         ZFS_IOC_CLEAR_FAULT,                    /* 0x1e */
  161         ZFS_IOC_INJECT_LIST_NEXT,               /* 0x1f */
  162         ZFS_IOC_ERROR_LOG,                      /* 0x20 */
  163         ZFS_IOC_CLEAR,                          /* 0x21 */
  164         ZFS_IOC_PROMOTE,                        /* 0x22 */
  165         /* start of mismatch */
  166 
  167         ZFS_IOC_DESTROY_SNAPS,                  /* 0x23:0x3b */
  168         ZFS_IOC_SNAPSHOT,                       /* 0x24:0x23 */
  169         ZFS_IOC_DSOBJ_TO_DSNAME,                /* 0x25:0x24 */
  170         ZFS_IOC_OBJ_TO_PATH,                    /* 0x26:0x25 */
  171         ZFS_IOC_POOL_SET_PROPS,                 /* 0x27:0x26 */
  172         ZFS_IOC_POOL_GET_PROPS,                 /* 0x28:0x27 */
  173         ZFS_IOC_SET_FSACL,                      /* 0x29:0x28 */
  174         ZFS_IOC_GET_FSACL,                      /* 0x30:0x29 */
  175         ZFS_IOC_SHARE,                          /* 0x2b:0x2a */
  176         ZFS_IOC_INHERIT_PROP,                   /* 0x2c:0x2b */
  177         ZFS_IOC_SMB_ACL,                        /* 0x2d:0x2c */
  178         ZFS_IOC_USERSPACE_ONE,                  /* 0x2e:0x2d */
  179         ZFS_IOC_USERSPACE_MANY,                 /* 0x2f:0x2e */
  180         ZFS_IOC_USERSPACE_UPGRADE,              /* 0x30:0x2f */
  181         ZFS_IOC_HOLD,                           /* 0x31:0x30 */
  182         ZFS_IOC_RELEASE,                        /* 0x32:0x31 */
  183         ZFS_IOC_GET_HOLDS,                      /* 0x33:0x32 */
  184         ZFS_IOC_OBJSET_RECVD_PROPS,             /* 0x34:0x33 */
  185         ZFS_IOC_VDEV_SPLIT,                     /* 0x35:0x34 */
  186         ZFS_IOC_NEXT_OBJ,                       /* 0x36:0x35 */
  187         ZFS_IOC_DIFF,                           /* 0x37:0x36 */
  188         ZFS_IOC_TMP_SNAPSHOT,                   /* 0x38:0x37 */
  189         ZFS_IOC_OBJ_TO_STATS,                   /* 0x39:0x38 */
  190         ZFS_IOC_JAIL,                   /* 0x3a:0xc2 */
  191         ZFS_IOC_UNJAIL,                 /* 0x3b:0xc3 */
  192         ZFS_IOC_POOL_REGUID,                    /* 0x3c:0x3c */
  193         ZFS_IOC_SPACE_WRITTEN,                  /* 0x3d:0x39 */
  194         ZFS_IOC_SPACE_SNAPS,                    /* 0x3e:0x3a */
  195         ZFS_IOC_SEND_PROGRESS,                  /* 0x3f:0x3e */
  196         ZFS_IOC_POOL_REOPEN,                    /* 0x40:0x3d */
  197         ZFS_IOC_LOG_HISTORY,                    /* 0x41:0x3f */
  198         ZFS_IOC_SEND_NEW,                       /* 0x42:0x40 */
  199         ZFS_IOC_SEND_SPACE,                     /* 0x43:0x41 */
  200         ZFS_IOC_CLONE,                          /* 0x44:0x42 */
  201         ZFS_IOC_BOOKMARK,                       /* 0x45:0x43 */
  202         ZFS_IOC_GET_BOOKMARKS,                  /* 0x46:0x44 */
  203         ZFS_IOC_DESTROY_BOOKMARKS,              /* 0x47:0x45 */
  204         ZFS_IOC_NEXTBOOT,                       /* 0x48:0xc1 */
  205         ZFS_IOC_CHANNEL_PROGRAM,                /* 0x49:0x48 */
  206         ZFS_IOC_REMAP,                          /* 0x4a:0x4c */
  207         ZFS_IOC_POOL_CHECKPOINT,                /* 0x4b:0x4d */
  208         ZFS_IOC_POOL_DISCARD_CHECKPOINT,        /* 0x4c:0x4e */
  209         ZFS_IOC_POOL_INITIALIZE,                /* 0x4d:0x4f */
  210 };
  211 
  212 static unsigned long zfs_ioctl_ozfs_to_legacy_common_[] = {
  213         ZFS_IOC_POOL_CREATE,                    /* 0x00 */
  214         ZFS_IOC_POOL_DESTROY,                   /* 0x01 */
  215         ZFS_IOC_POOL_IMPORT,                    /* 0x02 */
  216         ZFS_IOC_POOL_EXPORT,                    /* 0x03 */
  217         ZFS_IOC_POOL_CONFIGS,                   /* 0x04 */
  218         ZFS_IOC_POOL_STATS,                     /* 0x05 */
  219         ZFS_IOC_POOL_TRYIMPORT,                 /* 0x06 */
  220         ZFS_IOC_POOL_SCAN,                      /* 0x07 */
  221         ZFS_IOC_POOL_FREEZE,                    /* 0x08 */
  222         ZFS_IOC_POOL_UPGRADE,                   /* 0x09 */
  223         ZFS_IOC_POOL_GET_HISTORY,               /* 0x0a */
  224         ZFS_IOC_VDEV_ADD,                       /* 0x0b */
  225         ZFS_IOC_VDEV_REMOVE,                    /* 0x0c */
  226         ZFS_IOC_VDEV_SET_STATE,                 /* 0x0d */
  227         ZFS_IOC_VDEV_ATTACH,                    /* 0x0e */
  228         ZFS_IOC_VDEV_DETACH,                    /* 0x0f */
  229         ZFS_IOC_VDEV_SETPATH,                   /* 0x10 */
  230         ZFS_IOC_VDEV_SETFRU,                    /* 0x11 */
  231         ZFS_IOC_OBJSET_STATS,                   /* 0x12 */
  232         ZFS_IOC_OBJSET_ZPLPROPS,                /* 0x13 */
  233         ZFS_IOC_DATASET_LIST_NEXT,              /* 0x14 */
  234         ZFS_IOC_SNAPSHOT_LIST_NEXT,             /* 0x15 */
  235         ZFS_IOC_SET_PROP,                       /* 0x16 */
  236         ZFS_IOC_CREATE,                         /* 0x17 */
  237         ZFS_IOC_DESTROY,                        /* 0x18 */
  238         ZFS_IOC_ROLLBACK,                       /* 0x19 */
  239         ZFS_IOC_RENAME,                         /* 0x1a */
  240         ZFS_IOC_RECV,                           /* 0x1b */
  241         ZFS_IOC_SEND,                           /* 0x1c */
  242         ZFS_IOC_INJECT_FAULT,                   /* 0x1d */
  243         ZFS_IOC_CLEAR_FAULT,                    /* 0x1e */
  244         ZFS_IOC_INJECT_LIST_NEXT,               /* 0x1f */
  245         ZFS_IOC_ERROR_LOG,                      /* 0x20 */
  246         ZFS_IOC_CLEAR,                          /* 0x21 */
  247         ZFS_IOC_PROMOTE,                        /* 0x22 */
  248         /* start of mismatch */
  249         ZFS_IOC_LEGACY_SNAPSHOT,                /* 0x23 */
  250         ZFS_IOC_LEGACY_DSOBJ_TO_DSNAME,         /* 0x24 */
  251         ZFS_IOC_LEGACY_OBJ_TO_PATH,             /* 0x25 */
  252         ZFS_IOC_LEGACY_POOL_SET_PROPS,          /* 0x26 */
  253         ZFS_IOC_LEGACY_POOL_GET_PROPS,          /* 0x27 */
  254         ZFS_IOC_LEGACY_SET_FSACL,               /* 0x28 */
  255         ZFS_IOC_LEGACY_GET_FSACL,               /* 0x29 */
  256         ZFS_IOC_LEGACY_SHARE,                   /* 0x2a */
  257         ZFS_IOC_LEGACY_INHERIT_PROP,            /* 0x2b */
  258         ZFS_IOC_LEGACY_SMB_ACL,                 /* 0x2c */
  259         ZFS_IOC_LEGACY_USERSPACE_ONE,           /* 0x2d */
  260         ZFS_IOC_LEGACY_USERSPACE_MANY,          /* 0x2e */
  261         ZFS_IOC_LEGACY_USERSPACE_UPGRADE,       /* 0x2f */
  262         ZFS_IOC_LEGACY_HOLD,                    /* 0x30 */
  263         ZFS_IOC_LEGACY_RELEASE,                 /* 0x31 */
  264         ZFS_IOC_LEGACY_GET_HOLDS,               /* 0x32 */
  265         ZFS_IOC_LEGACY_OBJSET_RECVD_PROPS,      /* 0x33 */
  266         ZFS_IOC_LEGACY_VDEV_SPLIT,              /* 0x34 */
  267         ZFS_IOC_LEGACY_NEXT_OBJ,                /* 0x35 */
  268         ZFS_IOC_LEGACY_DIFF,                    /* 0x36 */
  269         ZFS_IOC_LEGACY_TMP_SNAPSHOT,            /* 0x37 */
  270         ZFS_IOC_LEGACY_OBJ_TO_STATS,            /* 0x38 */
  271         ZFS_IOC_LEGACY_SPACE_WRITTEN,           /* 0x39 */
  272         ZFS_IOC_LEGACY_SPACE_SNAPS,             /* 0x3a */
  273         ZFS_IOC_LEGACY_DESTROY_SNAPS,           /* 0x3b */
  274         ZFS_IOC_LEGACY_POOL_REGUID,             /* 0x3c */
  275         ZFS_IOC_LEGACY_POOL_REOPEN,             /* 0x3d */
  276         ZFS_IOC_LEGACY_SEND_PROGRESS,           /* 0x3e */
  277         ZFS_IOC_LEGACY_LOG_HISTORY,             /* 0x3f */
  278         ZFS_IOC_LEGACY_SEND_NEW,                /* 0x40 */
  279         ZFS_IOC_LEGACY_SEND_SPACE,              /* 0x41 */
  280         ZFS_IOC_LEGACY_CLONE,                   /* 0x42 */
  281         ZFS_IOC_LEGACY_BOOKMARK,                /* 0x43 */
  282         ZFS_IOC_LEGACY_GET_BOOKMARKS,           /* 0x44 */
  283         ZFS_IOC_LEGACY_DESTROY_BOOKMARKS,       /* 0x45 */
  284         ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_RECV_NEW */
  285         ZFS_IOC_LEGACY_POOL_SYNC,               /* 0x47 */
  286         ZFS_IOC_LEGACY_CHANNEL_PROGRAM,         /* 0x48 */
  287         ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_LOAD_KEY */
  288         ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_UNLOAD_KEY */
  289         ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_CHANGE_KEY */
  290         ZFS_IOC_LEGACY_REMAP,                   /* 0x4c */
  291         ZFS_IOC_LEGACY_POOL_CHECKPOINT,         /* 0x4d */
  292         ZFS_IOC_LEGACY_POOL_DISCARD_CHECKPOINT, /* 0x4e */
  293         ZFS_IOC_LEGACY_POOL_INITIALIZE,         /* 0x4f  */
  294         ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_POOL_TRIM */
  295         ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_REDACT */
  296         ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_GET_BOOKMARK_PROPS */
  297         ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_WAIT */
  298         ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_WAIT_FS */
  299 };
  300 
  301 static unsigned long zfs_ioctl_ozfs_to_legacy_platform_[] = {
  302         ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_EVENTS_NEXT */
  303         ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_EVENTS_CLEAR */
  304         ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_EVENTS_SEEK */
  305         ZFS_IOC_LEGACY_NEXTBOOT,
  306         ZFS_IOC_LEGACY_JAIL,
  307         ZFS_IOC_LEGACY_UNJAIL,
  308         ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_SET_BOOTENV */
  309         ZFS_IOC_LEGACY_NONE, /* ZFS_IOC_GET_BOOTENV */
  310 };
  311 
  312 int
  313 zfs_ioctl_legacy_to_ozfs(int request)
  314 {
  315         if (request >= sizeof (zfs_ioctl_legacy_to_ozfs_)/sizeof (long))
  316                 return (-1);
  317         return (zfs_ioctl_legacy_to_ozfs_[request]);
  318 }
  319 
  320 int
  321 zfs_ioctl_ozfs_to_legacy(int request)
  322 {
  323         if (request >= ZFS_IOC_LAST)
  324                 return (-1);
  325 
  326         if (request > ZFS_IOC_PLATFORM) {
  327                 request -= ZFS_IOC_PLATFORM + 1;
  328                 return (zfs_ioctl_ozfs_to_legacy_platform_[request]);
  329         }
  330         if (request >= sizeof (zfs_ioctl_ozfs_to_legacy_common_)/sizeof (long))
  331                 return (-1);
  332         return (zfs_ioctl_ozfs_to_legacy_common_[request]);
  333 }
  334 
  335 void
  336 zfs_cmd_legacy_to_ozfs(zfs_cmd_legacy_t *src, zfs_cmd_t *dst)
  337 {
  338         memcpy(dst, src, offsetof(zfs_cmd_t, zc_objset_stats));
  339         *&dst->zc_objset_stats = *&src->zc_objset_stats;
  340         memcpy(&dst->zc_begin_record, &src->zc_begin_record,
  341             offsetof(zfs_cmd_t, zc_sendobj) -
  342             offsetof(zfs_cmd_t, zc_begin_record));
  343         memcpy(&dst->zc_sendobj, &src->zc_sendobj,
  344             sizeof (zfs_cmd_t) - 8 - offsetof(zfs_cmd_t, zc_sendobj));
  345         dst->zc_zoneid = src->zc_jailid;
  346 }
  347 
  348 void
  349 zfs_cmd_ozfs_to_legacy(zfs_cmd_t *src, zfs_cmd_legacy_t *dst)
  350 {
  351         memcpy(dst, src, offsetof(zfs_cmd_t, zc_objset_stats));
  352         *&dst->zc_objset_stats = *&src->zc_objset_stats;
  353         *&dst->zc_begin_record.drr_u.drr_begin = *&src->zc_begin_record;
  354         dst->zc_begin_record.drr_payloadlen = 0;
  355         dst->zc_begin_record.drr_type = 0;
  356 
  357         memcpy(&dst->zc_inject_record, &src->zc_inject_record,
  358             offsetof(zfs_cmd_t, zc_sendobj) -
  359             offsetof(zfs_cmd_t, zc_inject_record));
  360         dst->zc_resumable = B_FALSE;
  361         memcpy(&dst->zc_sendobj, &src->zc_sendobj,
  362             sizeof (zfs_cmd_t) - 8 - offsetof(zfs_cmd_t, zc_sendobj));
  363         dst->zc_jailid = src->zc_zoneid;
  364 }
  365 #endif /* ZFS_LEGACY_SUPPORT */

Cache object: 957f90cadc3de749698f6d2503dfdccf


[ 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.