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/zoneadm/zoneadm.c
          +++ new/usr/src/cmd/zoneadm/zoneadm.c
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
  25   25   */
  26   26  
  27      -#pragma ident   "@(#)zoneadm.c  1.64    08/01/14 SMI"
       27 +#pragma ident   "@(#)zoneadm.c  1.65    08/05/07 SMI"
  28   28  
  29   29  /*
  30   30   * zoneadm is a command interpreter for zone administration.  It is all in
  31   31   * C (i.e., no lex/yacc), and all the argument passing is argc/argv based.
  32   32   * main() calls parse_and_run() which calls cmd_match(), then invokes the
  33   33   * appropriate command's handler function.  The rest of the program is the
  34   34   * handler functions and their helper functions.
  35   35   *
  36   36   * Some of the helper functions are used largely to simplify I18N: reducing
  37   37   * the need for translation notes.  This is particularly true of many of
↓ open down ↓ 2392 lines elided ↑ open up ↑
2430 2430  
2431 2431          return (return_code);
2432 2432  }
2433 2433  
2434 2434  /*
2435 2435   * Verify that the special device/file system exists and is valid.
2436 2436   */
2437 2437  static int
2438 2438  verify_fs_special(struct zone_fstab *fstab)
2439 2439  {
2440      -        struct stat st;
     2440 +        struct stat64 st;
2441 2441  
2442 2442          /*
2443 2443           * This validation is really intended for standard zone administration.
2444 2444           * If we are in a mini-root or some other upgrade situation where
2445 2445           * we are using the scratch zone, just by-pass this.
2446 2446           */
2447 2447          if (zonecfg_in_alt_root())
2448 2448                  return (Z_OK);
2449 2449  
2450 2450          if (strcmp(fstab->zone_fs_type, MNTTYPE_ZFS) == 0)
2451 2451                  return (verify_fs_zfs(fstab));
2452 2452  
2453      -        if (stat(fstab->zone_fs_special, &st) != 0) {
     2453 +        if (stat64(fstab->zone_fs_special, &st) != 0) {
2454 2454                  (void) fprintf(stderr, gettext("could not verify fs "
2455 2455                      "%s: could not access %s: %s\n"), fstab->zone_fs_dir,
2456 2456                      fstab->zone_fs_special, strerror(errno));
2457 2457                  return (Z_ERR);
2458 2458          }
2459 2459  
2460 2460          if (strcmp(st.st_fstype, MNTTYPE_NFS) == 0) {
2461 2461                  /*
2462 2462                   * TRANSLATION_NOTE
2463 2463                   * fs and NFS are literals that should
↓ open down ↓ 3 lines elided ↑ open up ↑
2467 2467                      "fs %s: NFS mounted file system.\n"
2468 2468                      "\tA local file system must be used.\n"),
2469 2469                      fstab->zone_fs_special);
2470 2470                  return (Z_ERR);
2471 2471          }
2472 2472  
2473 2473          return (Z_OK);
2474 2474  }
2475 2475  
2476 2476  static int
     2477 +isregfile(const char *path)
     2478 +{
     2479 +        struct stat64 st;
     2480 +
     2481 +        if (stat64(path, &st) == -1)
     2482 +                return (-1);
     2483 +
     2484 +        return (S_ISREG(st.st_mode));
     2485 +}
     2486 +
     2487 +static int
2477 2488  verify_filesystems(zone_dochandle_t handle)
2478 2489  {
2479 2490          int return_code = Z_OK;
2480 2491          struct zone_fstab fstab;
2481 2492          char cmdbuf[MAXPATHLEN];
2482 2493          struct stat st;
2483 2494  
2484 2495          /*
2485 2496           * No need to verify inherit-pkg-dir fs types, as their type is
2486 2497           * implicitly lofs, which is known.  Therefore, the types are only