Print this page
PSARC 2008/290 lofi mount
6384817 Need persistent lofi based mounts and direct mount(1m) support for lofi

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/lofiadm/main.c
          +++ new/usr/src/cmd/lofiadm/main.c
↓ open down ↓ 11 lines elided ↑ open up ↑
  12   12   *
  13   13   * When distributing Covered Code, include this CDDL HEADER in each
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  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      - * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
       22 + * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
  26   26  /*
  27   27   * lofiadm - administer lofi(7d). Very simple, add and remove file<->device
  28   28   * associations, and display status. All the ioctls are private between
  29   29   * lofi and lofiadm, and so are very simple - device information is
  30   30   * communicated via a minor number.
  31   31   */
  32   32  
  33      -#pragma ident   "@(#)main.c     1.8     07/12/18 SMI"
       33 +#pragma ident   "@(#)main.c     1.9     08/05/07 SMI"
  34   34  
  35   35  #include <sys/types.h>
  36   36  #include <sys/param.h>
  37   37  #include <sys/lofi.h>
  38   38  #include <sys/stat.h>
  39   39  #include <netinet/in.h>
  40   40  #include <stdio.h>
  41   41  #include <fcntl.h>
  42   42  #include <locale.h>
  43   43  #include <string.h>
↓ open down ↓ 253 lines elided ↑ open up ↑
 297  297   * Remove an association. Delete by device name if non-NULL, or by
 298  298   * filename otherwise.
 299  299   */
 300  300  static void
 301  301  delete_mapping(int lfd, const char *devicename, const char *filename,
 302  302      boolean_t force)
 303  303  {
 304  304          struct lofi_ioctl li;
 305  305  
 306  306          li.li_force = force;
      307 +        li.li_cleanup = 0;
      308 +
 307  309          if (devicename == NULL) {
 308  310                  /* delete by filename */
 309  311                  (void) strlcpy(li.li_filename, filename,
 310  312                      sizeof (li.li_filename));
 311  313                  li.li_minor = 0;
 312  314                  if (ioctl(lfd, LOFI_UNMAP_FILE, &li) == -1) {
 313  315                          die(gettext("could not unmap file %s"), filename);
 314  316                  }
 315  317                  return;
 316  318          }
↓ open down ↓ 706 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX