Print this page
6198 Let's EOL cachefs

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/svr4pkg/libinst/mntinfo.c
          +++ new/usr/src/cmd/svr4pkg/libinst/mntinfo.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 2009 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   28  
  28   29  /*
  29   30   * System includes
  30   31   */
  31   32  
  32   33  #include <stdio.h>
  33   34  #include <limits.h>
  34   35  #include <errno.h>
↓ open down ↓ 63 lines elided ↑ open up ↑
  98   99  
  99  100  /*
 100  101   * Due to /etc/mnttab files containing entries for multiple nfs hosts
 101  102   * HOST_NM_LN needs to be accommodating. The recommended value in the sysinfo
 102  103   * man page of 257 needs to be expanded. See bugid 4076513.
 103  104   * 1024 chars is defined in the mnttab.h header as the max size of an entry.
 104  105   */
 105  106  
 106  107  #define HOST_NM_LN      MNT_LINE_MAX
 107  108  
 108      -/* These cachefs definitions should be in mntent.h. Maybe some day. */
 109      -#define MNTTYPE_CFS             "cachefs"
 110      -#define MNTOPT_BACKFSTYPE       "backfstype"
 111      -#define MNTTYPE_AUTO            "autofs"
 112      -
 113  109  /*
 114  110   * Utilities for getting filesystem information from the mount table.
 115  111   *
 116  112   * Note: vanilla SVr4 code (pkginstall/dockspace.c) used the output from
 117  113   * popen() on the "/etc/mount" command.  However, we need to get more
 118  114   * information about mounted filesystems, so we use the C interfaces to
 119  115   * the mount table, which also happens to be much faster than running
 120  116   * another process.  Since several of the pkg commands need access to the
 121  117   * the code has been placed here, to be included in the libinst library.
 122  118   */
↓ open down ↓ 97 lines elided ↑ open up ↑
 220  216  {
 221  217          static char hostname[HOST_NM_LN], *host_end;
 222  218  
 223  219          if (fs_tab_used == 0) {
 224  220                  return ("unknown source");
 225  221          }
 226  222  
 227  223          if (n < fs_tab_used) {
 228  224                  (void) strcpy(hostname, fs_tab[n]->remote_name);
 229  225                  if ((host_end = strchr(hostname, ':')) == NULL) {
 230      -                        if ((strcmp(fs_tab[n]->fstype, MNTTYPE_AUTO)) == NULL)
      226 +                        if ((strcmp(fs_tab[n]->fstype, MNTTYPE_AUTOFS)) == NULL)
 231  227                                  return ("automounter");
 232  228                          else
 233  229                                  return (fs_tab[n]->fstype);
 234  230                  } else {
 235  231                          *host_end = '\0';
 236  232                          return (hostname);
 237  233                  }
 238  234          }
 239  235  
 240  236          return ("unknown source");
↓ open down ↓ 466 lines elided ↑ open up ↑
 707  703          if ((nfte = fs_tab_init(mt->mnt_mountp, mt->mnt_fstype)) == NULL)
 708  704                  return (1);
 709  705  
 710  706          /*
 711  707           * See if this is served from another host.
 712  708           * Testing the type is cheap; finding the hostname is not.
 713  709           * At this point, we're using the REAL mnttab; since we're not
 714  710           * allowed to mount ourself with "NFS", "NFS" must be remote.
 715  711           * The automount will translate "nfs:self" to a lofs mount.
 716  712           */
 717      -        if (strcmp(mt->mnt_fstype, MNTTYPE_AUTO) == 0 ||
      713 +        if (strcmp(mt->mnt_fstype, MNTTYPE_AUTOFS) == 0 ||
 718  714              strcmp(mt->mnt_fstype, MNTTYPE_NFS) == 0 ||
 719  715              is_remote_src(mt->mnt_special) == REAL_REMOTE)
 720  716                  nfte->remote = 1;
 721  717          else
 722  718                  nfte->remote = 0;
 723  719  
 724  720          /* It's mounted now (by definition), so we don't have to remap it. */
 725  721          nfte->srvr_map = 0;
 726  722          nfte->mounted = 1;
 727  723  
↓ open down ↓ 228 lines elided ↑ open up ↑
 956  952                                              install_root);
 957  953                                  } else {
 958  954                                          (void) snprintf(client_mountp,
 959  955                                              sizeof (client_mountp), "%s%s",
 960  956                                              install_root, vfs->vfs_mountp);
 961  957                                  }
 962  958  
 963  959                                  /*
 964  960                                   * We also skip the entry if the vfs_special
 965  961                                   * path and the client_path are the same.
 966      -                                 * There's no need to mount it, it's just a
 967      -                                 * cachefs optimization that mounts a
 968      -                                 * directory over itself from this server.
 969  962                                   */
 970  963                                  if ((is_remote == SELF_SERVE) &&
 971  964                                      strcmp(path_part(vfs->vfs_special),
 972  965                                      client_mountp) == 0)
 973  966                                          continue;
 974  967  
 975  968                                  /* Determine if this is already mounted. */
 976  969                                  link_name = strdup(path_part(vfs->vfs_special));
 977  970                                  mnt_stat = already_mounted(vfs,
 978  971                                      (is_remote != REAL_REMOTE), client_mountp,
↓ open down ↓ 465 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX