Print this page
6063 pkgadd breaks with too many mountpoints
        
*** 214,232 ****
          return (retval);
  }
  
  /* This returns the hostname portion of a remote path. */
  char *
! get_server_host(short n)
  {
          static char hostname[HOST_NM_LN], *host_end;
  
          if (fs_tab_used == 0) {
                  return ("unknown source");
          }
  
!         if (n >= 0 && n < fs_tab_used) {
                  (void) strcpy(hostname, fs_tab[n]->remote_name);
                  if ((host_end = strchr(hostname, ':')) == NULL) {
                          if ((strcmp(fs_tab[n]->fstype, MNTTYPE_AUTO)) == NULL)
                                  return ("automounter");
                          else
--- 214,232 ----
          return (retval);
  }
  
  /* This returns the hostname portion of a remote path. */
  char *
! get_server_host(uint32_t n)
  {
          static char hostname[HOST_NM_LN], *host_end;
  
          if (fs_tab_used == 0) {
                  return ("unknown source");
          }
  
!         if (n < fs_tab_used) {
                  (void) strcpy(hostname, fs_tab[n]->remote_name);
                  if ((host_end = strchr(hostname, ':')) == NULL) {
                          if ((strcmp(fs_tab[n]->fstype, MNTTYPE_AUTO)) == NULL)
                                  return ("automounter");
                          else
*** 564,580 ****
   * filesystem. fsys_value is the fs_tab[] entry to which the loopback'd path is
   * mapped. This returns a pointer to a static area. If the result is needed
   * for further processing, it should be strdup()'d or something.
   */
  char *
! server_map(char *path, short fsys_value)
  {
          static char server_construction[PATH_MAX];
  
          if (fs_tab_used == 0) {
                  (void) strcpy(server_construction, path);
!         } else if (fsys_value >= 0 && fsys_value < fs_tab_used) {
                  (void) snprintf(server_construction,
                          sizeof (server_construction),
                          "%s%s", fs_tab[fsys_value]->remote_name,
                          path+strlen(fs_tab[fsys_value]->name));
          } else {
--- 564,580 ----
   * filesystem. fsys_value is the fs_tab[] entry to which the loopback'd path is
   * mapped. This returns a pointer to a static area. If the result is needed
   * for further processing, it should be strdup()'d or something.
   */
  char *
! server_map(char *path, uint32_t fsys_value)
  {
          static char server_construction[PATH_MAX];
  
          if (fs_tab_used == 0) {
                  (void) strcpy(server_construction, path);
!         } else if (fsys_value < fs_tab_used) {
                  (void) snprintf(server_construction,
                          sizeof (server_construction),
                          "%s%s", fs_tab[fsys_value]->remote_name,
                          path+strlen(fs_tab[fsys_value]->name));
          } else {
*** 1049,1059 ****
   * Given a path, return the table index of the filesystem the file apparently
   * resides on. This doesn't put any time into resolving filesystems that
   * refer to other filesystems. It just returns the entry containing this
   * path.
   */
! short
  fsys(char *path)
  {
          register int i;
          char    real_path[PATH_MAX];
          char    path_copy[PATH_MAX];
--- 1049,1059 ----
   * Given a path, return the table index of the filesystem the file apparently
   * resides on. This doesn't put any time into resolving filesystems that
   * refer to other filesystems. It just returns the entry containing this
   * path.
   */
! uint32_t
  fsys(char *path)
  {
          register int i;
          char    real_path[PATH_MAX];
          char    path_copy[PATH_MAX];
*** 1145,1155 ****
   * This function returns the entry in the fs_tab[] corresponding to the
   * actual filesystem of record. It won't return a loopback filesystem entry,
   * it will return the filesystem that the loopback filesystem is mounted
   * over.
   */
! short
  resolved_fsys(char *path)
  {
          int i = -1;
          char path2use[PATH_MAX];
  
--- 1145,1155 ----
   * This function returns the entry in the fs_tab[] corresponding to the
   * actual filesystem of record. It won't return a loopback filesystem entry,
   * it will return the filesystem that the loopback filesystem is mounted
   * over.
   */
! uint32_t
  resolved_fsys(char *path)
  {
          int i = -1;
          char path2use[PATH_MAX];
  
*** 1168,1178 ****
   * This function returns the srvr_map status based upon the fs_tab entry
   * number. This tells us if the server path constructed from the package
   * install root is really the target filesystem.
   */
  int
! use_srvr_map_n(short n)
  {
          return ((int)fs_tab[n]->srvr_map);
  }
  
  /*
--- 1168,1178 ----
   * This function returns the srvr_map status based upon the fs_tab entry
   * number. This tells us if the server path constructed from the package
   * install root is really the target filesystem.
   */
  int
! use_srvr_map_n(uint32_t n)
  {
          return ((int)fs_tab[n]->srvr_map);
  }
  
  /*
*** 1179,1199 ****
   * This function returns the mount status based upon the fs_tab entry
   * number. This tells us if there is any hope of gaining access
   * to this file system.
   */
  int
! is_mounted_n(short n)
  {
          return ((int)fs_tab[n]->mounted);
  }
  
  /*
   * is_fs_writeable_n - given an fstab index, return 1
   *      if it's writeable, 0 if read-only.
   */
  int
! is_fs_writeable_n(short n)
  {
          /*
           * If the write access permissions haven't been confirmed, do that
           * now. Note that the only reason we need to do the special check is
           * in the case of an NFS mount (remote) because we can't determine if
--- 1179,1199 ----
   * This function returns the mount status based upon the fs_tab entry
   * number. This tells us if there is any hope of gaining access
   * to this file system.
   */
  int
! is_mounted_n(uint32_t n)
  {
          return ((int)fs_tab[n]->mounted);
  }
  
  /*
   * is_fs_writeable_n - given an fstab index, return 1
   *      if it's writeable, 0 if read-only.
   */
  int
! is_fs_writeable_n(uint32_t n)
  {
          /*
           * If the write access permissions haven't been confirmed, do that
           * now. Note that the only reason we need to do the special check is
           * in the case of an NFS mount (remote) because we can't determine if
*** 1215,1232 ****
   *      if it's a remote filesystem, 0 if local.
   *
   *      Note: Upon entry, a valid fsys() is required.
   */
  int
! is_remote_fs_n(short n)
  {
          return ((int)fs_tab[n]->remote);
  }
  
  /* index-driven is_served() */
  int
! is_served_n(short n)
  {
          return ((int)fs_tab[n]->served);
  }
  
  /*
--- 1215,1232 ----
   *      if it's a remote filesystem, 0 if local.
   *
   *      Note: Upon entry, a valid fsys() is required.
   */
  int
! is_remote_fs_n(uint32_t n)
  {
          return ((int)fs_tab[n]->remote);
  }
  
  /* index-driven is_served() */
  int
! is_served_n(uint32_t n)
  {
          return ((int)fs_tab[n]->served);
  }
  
  /*
*** 1233,1243 ****
   * This returns the number of blocks available on the indicated filesystem.
   *
   *      Note: Upon entry, a valid fsys() is required.
   */
  fsblkcnt_t
! get_blk_free_n(short n)
  {
          return (fs_tab[n]->bfree);
  }
  
  /*
--- 1233,1243 ----
   * This returns the number of blocks available on the indicated filesystem.
   *
   *      Note: Upon entry, a valid fsys() is required.
   */
  fsblkcnt_t
! get_blk_free_n(uint32_t n)
  {
          return (fs_tab[n]->bfree);
  }
  
  /*
*** 1244,1254 ****
   * This returns the number of blocks being used on the indicated filesystem.
   *
   *      Note: Upon entry, a valid fsys() is required.
   */
  fsblkcnt_t
! get_blk_used_n(short n)
  {
          return (fs_tab[n]->bused);
  }
  
  /*
--- 1244,1254 ----
   * This returns the number of blocks being used on the indicated filesystem.
   *
   *      Note: Upon entry, a valid fsys() is required.
   */
  fsblkcnt_t
! get_blk_used_n(uint32_t n)
  {
          return (fs_tab[n]->bused);
  }
  
  /*
*** 1255,1265 ****
   * This returns the number of inodes available on the indicated filesystem.
   *
   *      Note: Upon entry, a valid fsys() is required.
   */
  fsblkcnt_t
! get_inode_free_n(short n)
  {
          return (fs_tab[n]->ffree);
  }
  
  /*
--- 1255,1265 ----
   * This returns the number of inodes available on the indicated filesystem.
   *
   *      Note: Upon entry, a valid fsys() is required.
   */
  fsblkcnt_t
! get_inode_free_n(uint32_t n)
  {
          return (fs_tab[n]->ffree);
  }
  
  /*
*** 1266,1276 ****
   * This returns the number of inodes being used on the indicated filesystem.
   *
   *      Note: Upon entry, a valid fsys() is required.
   */
  fsblkcnt_t
! get_inode_used_n(short n)
  {
          return (fs_tab[n]->fused);
  }
  
  /*
--- 1266,1276 ----
   * This returns the number of inodes being used on the indicated filesystem.
   *
   *      Note: Upon entry, a valid fsys() is required.
   */
  fsblkcnt_t
! get_inode_used_n(uint32_t n)
  {
          return (fs_tab[n]->fused);
  }
  
  /*
*** 1277,1310 ****
   * Sets the number of blocks being used on the indicated filesystem.
   *
   *      Note: Upon entry, a valid fsys() is required.
   */
  void
! set_blk_used_n(short n, fsblkcnt_t value)
  {
          fs_tab[n]->bused = value;
  }
  
  /* Get the filesystem block size. */
  fsblkcnt_t
! get_blk_size_n(short n)
  {
          return (fs_tab[n]->bsize);
  }
  
  /* Get the filesystem fragment size. */
  fsblkcnt_t
! get_frag_size_n(short n)
  {
          return (fs_tab[n]->bsize);
  }
  
  /*
   * This returns the name of the indicated filesystem.
   */
  char *
! get_fs_name_n(short n)
  {
          if (fs_tab_used == 0) {
                  return (NULL);
          } else if (n >= fs_tab_used) {
                  return (NULL);
--- 1277,1310 ----
   * Sets the number of blocks being used on the indicated filesystem.
   *
   *      Note: Upon entry, a valid fsys() is required.
   */
  void
! set_blk_used_n(uint32_t n, fsblkcnt_t value)
  {
          fs_tab[n]->bused = value;
  }
  
  /* Get the filesystem block size. */
  fsblkcnt_t
! get_blk_size_n(uint32_t n)
  {
          return (fs_tab[n]->bsize);
  }
  
  /* Get the filesystem fragment size. */
  fsblkcnt_t
! get_frag_size_n(uint32_t n)
  {
          return (fs_tab[n]->bsize);
  }
  
  /*
   * This returns the name of the indicated filesystem.
   */
  char *
! get_fs_name_n(uint32_t n)
  {
          if (fs_tab_used == 0) {
                  return (NULL);
          } else if (n >= fs_tab_used) {
                  return (NULL);
*** 1317,1336 ****
   * This returns the remote name of the indicated filesystem.
   *
   *      Note: Upon entry, a valid fsys() is required.
   */
  char *
! get_source_name_n(short n)
  {
          return (fs_tab[n]->remote_name);
  }
  
  /*
   * This function returns the srvr_map status based upon the path.
   */
  int
! use_srvr_map(char *path, short *fsys_value)
  {
          if (*fsys_value == BADFSYS)
                  *fsys_value = fsys(path);
  
          return (use_srvr_map_n(*fsys_value));
--- 1317,1336 ----
   * This returns the remote name of the indicated filesystem.
   *
   *      Note: Upon entry, a valid fsys() is required.
   */
  char *
! get_source_name_n(uint32_t n)
  {
          return (fs_tab[n]->remote_name);
  }
  
  /*
   * This function returns the srvr_map status based upon the path.
   */
  int
! use_srvr_map(char *path, uint32_t *fsys_value)
  {
          if (*fsys_value == BADFSYS)
                  *fsys_value = fsys(path);
  
          return (use_srvr_map_n(*fsys_value));
*** 1338,1348 ****
  
  /*
   * This function returns the mount status based upon the path.
   */
  int
! is_mounted(char *path, short *fsys_value)
  {
          if (*fsys_value == BADFSYS)
                  *fsys_value = fsys(path);
  
          return (is_mounted_n(*fsys_value));
--- 1338,1348 ----
  
  /*
   * This function returns the mount status based upon the path.
   */
  int
! is_mounted(char *path, uint32_t *fsys_value)
  {
          if (*fsys_value == BADFSYS)
                  *fsys_value = fsys(path);
  
          return (is_mounted_n(*fsys_value));
*** 1354,1364 ****
   *
   *      Note: Upon exit, a valid fsys() is guaranteed. This is
   *      an interface requirement.
   */
  int
! is_fs_writeable(char *path, short *fsys_value)
  {
          if (*fsys_value == BADFSYS)
                  *fsys_value = fsys(path);
  
          return (is_fs_writeable_n(*fsys_value));
--- 1354,1364 ----
   *
   *      Note: Upon exit, a valid fsys() is guaranteed. This is
   *      an interface requirement.
   */
  int
! is_fs_writeable(char *path, uint32_t *fsys_value)
  {
          if (*fsys_value == BADFSYS)
                  *fsys_value = fsys(path);
  
          return (is_fs_writeable_n(*fsys_value));
*** 1370,1380 ****
   *
   *      Also Note: Upon exit, a valid fsys() is guaranteed. This is
   *      an interface requirement.
   */
  int
! is_remote_fs(char *path, short *fsys_value)
  {
          if (*fsys_value == BADFSYS)
                  *fsys_value = fsys(path);
  
          return (is_remote_fs_n(*fsys_value));
--- 1370,1380 ----
   *
   *      Also Note: Upon exit, a valid fsys() is guaranteed. This is
   *      an interface requirement.
   */
  int
! is_remote_fs(char *path, uint32_t *fsys_value)
  {
          if (*fsys_value == BADFSYS)
                  *fsys_value = fsys(path);
  
          return (is_remote_fs_n(*fsys_value));
*** 1385,1395 ****
   * client is getting this file from a server and it is not writeable by the
   * client. It has nothing to do with whether or not this particular operation
   * (eg: pkgadd or pkgrm) will be writing to it.
   */
  int
! is_served(char *path, short *fsys_value)
  {
          if (*fsys_value == BADFSYS)
                  *fsys_value = fsys(path);
  
          return (is_served_n(*fsys_value));
--- 1385,1395 ----
   * client is getting this file from a server and it is not writeable by the
   * client. It has nothing to do with whether or not this particular operation
   * (eg: pkgadd or pkgrm) will be writing to it.
   */
  int
! is_served(char *path, uint32_t *fsys_value)
  {
          if (*fsys_value == BADFSYS)
                  *fsys_value = fsys(path);
  
          return (is_served_n(*fsys_value));
*** 1399,1409 ****
   * get_remote_path - given a filesystem table index, return the
   *      path of the filesystem on the remote system.  Otherwise,
   *      return NULL if it's a local filesystem.
   */
  char *
! get_remote_path(short n)
  {
          char    *p;
  
          if (!is_remote_fs_n(n))
                  return (NULL);  /* local */
--- 1399,1409 ----
   * get_remote_path - given a filesystem table index, return the
   *      path of the filesystem on the remote system.  Otherwise,
   *      return NULL if it's a local filesystem.
   */
  char *
! get_remote_path(uint32_t n)
  {
          char    *p;
  
          if (!is_remote_fs_n(n))
                  return (NULL);  /* local */
*** 1419,1437 ****
   * get_mount_point - given a filesystem table index, return the
   *      path of the mount point.  Otherwise,
   *      return NULL if it's a local filesystem.
   */
  char *
! get_mount_point(short n)
  {
          if (!is_remote_fs_n(n))
                  return (NULL);  /* local */
          return (fs_tab[n]->name);
  }
  
  struct fstable *
! get_fs_entry(short n)
  {
          if (fs_tab_used == 0) {
                  return (NULL);
          } else if (n >= fs_tab_used) {
                  return (NULL);
--- 1419,1437 ----
   * get_mount_point - given a filesystem table index, return the
   *      path of the mount point.  Otherwise,
   *      return NULL if it's a local filesystem.
   */
  char *
! get_mount_point(uint32_t n)
  {
          if (!is_remote_fs_n(n))
                  return (NULL);  /* local */
          return (fs_tab[n]->name);
  }
  
  struct fstable *
! get_fs_entry(uint32_t n)
  {
          if (fs_tab_used == 0) {
                  return (NULL);
          } else if (n >= fs_tab_used) {
                  return (NULL);