Print this page
6198 Let's EOL cachefs

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/cmd-inet/sbin/netstrategy/netstrategy.c
          +++ new/usr/src/cmd/cmd-inet/sbin/netstrategy/netstrategy.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  /*
  23   23   * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
       25 + * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
  25   26   */
  26   27  
  27      -#pragma ident   "%Z%%M% %I%     %E% SMI"
  28   28  
  29   29  /*
  30   30   * This program does the following:
  31   31   *
  32   32   * a) Returns:
  33   33   *      0       - if the program successfully determined the net strategy.
  34   34   *      !0      - if an error occurred.
  35   35   *
  36   36   * b) If the program is successful, it prints three tokens to
  37   37   *    stdout: <root fs type> <interface name> <net config strategy>.
  38   38   *    where:
  39      - *      <root fs type>          -       "nfs" or "ufs"
       39 + *      <root fs type>          -       "nfs", "ufs" or "zfs"
  40   40   *      <interface name>        -       "hme0" or "none"
  41   41   *      <net config strategy>   -       "dhcp", "rarp", "bootprops"
  42   42   *                                      or "none"
  43   43   *
  44   44   *    Eg:
  45   45   *      # /sbin/netstrategy
  46   46   *      ufs hme0 dhcp
  47   47   *
  48   48   *    <root fs type> identifies the system's root file system type.
  49   49   *
↓ open down ↓ 251 lines elided ↑ open up ↑
 301  301                  (void) printf("%s %s %s\n", root, interface, strategy);
 302  302                  close_sockets();
 303  303                  return (0);
 304  304          }
 305  305  
 306  306          /*
 307  307           * We're not "nfs dhcp", "nfs none" is impossible, and we don't handle
 308  308           * "ufs rarp" (consumers are coded to deal with this reality), so
 309  309           * there are three possible situations:
 310  310           *
 311      -         *      1. We're "ufs dhcp" if there are any interfaces which have
 312      -         *         obtained their addresses through DHCP.  That is, if there
 313      -         *         are any IFF_UP and non-IFF_VIRTUAL interfaces also have
 314      -         *         IFF_DHCPRUNNING set.
      311 +         *      1. We're either "ufs dhcp" or "zfs dhcp" if there are any
      312 +         *         interfaces which have obtained their addresses through DHCP.
      313 +         *         That is, if there are any IFF_UP and non-IFF_VIRTUAL
      314 +         *         interfaces also have IFF_DHCPRUNNING set.
 315  315           *
 316      -         *      2. We're "ufs none" if our filesystem is local and there
 317      -         *         are no interfaces which have obtained their addresses
 318      -         *         through DHCP.
      316 +         *      2. We're either "ufs none" or "zfs none" if our filesystem
      317 +         *         is local and there are no interfaces which have obtained
      318 +         *         their addresses through DHCP.
 319  319           *
 320  320           *      3. We're "nfs rarp" if our filesystem is remote and there's
 321  321           *         at least IFF_UP non-IFF_VIRTUAL interface (which there
 322  322           *         *must* be, since we're running over NFS somehow), then
 323  323           *         it must be RARP since SI_DHCP_CACHE call above failed.
 324  324           *         It's too bad there isn't an IFF_RARPRUNNING flag.
 325  325           */
 326  326  
 327  327          interface = get_first_interface(&dhcp_running);
 328  328  
 329  329          if (dhcp_running)
 330  330                  strategy = "dhcp";
 331  331  
 332      -        if (strcmp(root, "nfs") == 0 || strcmp(root, "cachefs") == 0) {
      332 +        if (strcmp(root, "nfs") == 0) {
 333  333                  if (interface == NULL) {
 334  334                          (void) fprintf(stderr,
 335  335                              "%s: cannot identify root interface.\n", program);
 336  336                          close_sockets();
 337  337                          return (2);
 338  338                  }
 339  339                  if (strategy == NULL)
 340  340                          strategy = "rarp";      /*  must be rarp/bootparams */
 341  341          } else {
 342  342                  if (interface == NULL || strategy == NULL)
 343  343                          interface = strategy = "none";
 344  344          }
 345  345  
 346  346          (void) printf("%s %s %s\n", root, interface, strategy);
 347  347          close_sockets();
 348  348          return (0);
 349  349  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX