Print this page
5857 add -o option to lofiadm
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/lofi.c
          +++ new/usr/src/uts/common/io/lofi.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   *
  24   24   * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
       25 + * Copyright (c) 2016 Andrey Sokolov
  25   26   */
  26   27  
  27   28  /*
  28   29   * lofi (loopback file) driver - allows you to attach a file to a device,
  29   30   * which can then be accessed through that device. The simple model is that
  30   31   * you tell lofi to open a file, and then use the block device you get as
  31   32   * you would any block device. lofi translates access to the block device
  32   33   * into I/O on the underlying file. This is mostly useful for
  33   34   * mounting images of filesystems.
  34   35   *
↓ open down ↓ 89 lines elided ↑ open up ↑
 124  125  #include <vm/seg_map.h>
 125  126  #include <sys/ddi.h>
 126  127  #include <sys/sunddi.h>
 127  128  #include <sys/zmod.h>
 128  129  #include <sys/id_space.h>
 129  130  #include <sys/mkdev.h>
 130  131  #include <sys/crypto/common.h>
 131  132  #include <sys/crypto/api.h>
 132  133  #include <sys/rctl.h>
 133  134  #include <LzmaDec.h>
 134      -
 135      -/*
 136      - * The basis for CRYOFF is derived from usr/src/uts/common/sys/fs/ufs_fs.h.
 137      - * Crypto metadata, if it exists, is located at the end of the boot block
 138      - * (BBOFF + BBSIZE, which is SBOFF).  The super block and everything after
 139      - * is offset by the size of the crypto metadata which is handled by
 140      - * lsp->ls_crypto_offset.
 141      - */
 142      -#define CRYOFF  ((off_t)8192)
 143  135  
 144  136  #define NBLOCKS_PROP_NAME       "Nblocks"
 145  137  #define SIZE_PROP_NAME          "Size"
 146  138  #define ZONE_PROP_NAME          "zone"
 147  139  
 148  140  #define SETUP_C_DATA(cd, buf, len)              \
 149  141          (cd).cd_format = CRYPTO_DATA_RAW;       \
 150  142          (cd).cd_offset = 0;                     \
 151  143          (cd).cd_miscdata = NULL;                \
 152  144          (cd).cd_length = (len);                 \
↓ open down ↓ 2663 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX