Print this page
6063 pkgadd breaks with too many mountpoints

@@ -214,19 +214,19 @@
         return (retval);
 }
 
 /* This returns the hostname portion of a remote path. */
 char *
-get_server_host(short n)
+get_server_host(uint32_t n)
 {
         static char hostname[HOST_NM_LN], *host_end;
 
         if (fs_tab_used == 0) {
                 return ("unknown source");
         }
 
-        if (n >= 0 && n < fs_tab_used) {
+        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,17 +564,17 @@
  * 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)
+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 >= 0 && fsys_value < fs_tab_used) {
+        } 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,11 +1049,11 @@
  * 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
+uint32_t
 fsys(char *path)
 {
         register int i;
         char    real_path[PATH_MAX];
         char    path_copy[PATH_MAX];

@@ -1145,11 +1145,11 @@
  * 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
+uint32_t
 resolved_fsys(char *path)
 {
         int i = -1;
         char path2use[PATH_MAX];
 

@@ -1168,11 +1168,11 @@
  * 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)
+use_srvr_map_n(uint32_t n)
 {
         return ((int)fs_tab[n]->srvr_map);
 }
 
 /*

@@ -1179,21 +1179,21 @@
  * 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)
+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(short n)
+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,18 +1215,18 @@
  *      if it's a remote filesystem, 0 if local.
  *
  *      Note: Upon entry, a valid fsys() is required.
  */
 int
-is_remote_fs_n(short n)
+is_remote_fs_n(uint32_t n)
 {
         return ((int)fs_tab[n]->remote);
 }
 
 /* index-driven is_served() */
 int
-is_served_n(short n)
+is_served_n(uint32_t n)
 {
         return ((int)fs_tab[n]->served);
 }
 
 /*

@@ -1233,11 +1233,11 @@
  * 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)
+get_blk_free_n(uint32_t n)
 {
         return (fs_tab[n]->bfree);
 }
 
 /*

@@ -1244,11 +1244,11 @@
  * 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)
+get_blk_used_n(uint32_t n)
 {
         return (fs_tab[n]->bused);
 }
 
 /*

@@ -1255,11 +1255,11 @@
  * 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)
+get_inode_free_n(uint32_t n)
 {
         return (fs_tab[n]->ffree);
 }
 
 /*

@@ -1266,11 +1266,11 @@
  * 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)
+get_inode_used_n(uint32_t n)
 {
         return (fs_tab[n]->fused);
 }
 
 /*

@@ -1277,34 +1277,34 @@
  * 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)
+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(short n)
+get_blk_size_n(uint32_t n)
 {
         return (fs_tab[n]->bsize);
 }
 
 /* Get the filesystem fragment size. */
 fsblkcnt_t
-get_frag_size_n(short n)
+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(short n)
+get_fs_name_n(uint32_t n)
 {
         if (fs_tab_used == 0) {
                 return (NULL);
         } else if (n >= fs_tab_used) {
                 return (NULL);

@@ -1317,20 +1317,20 @@
  * This returns the remote name of the indicated filesystem.
  *
  *      Note: Upon entry, a valid fsys() is required.
  */
 char *
-get_source_name_n(short n)
+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, short *fsys_value)
+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,11 +1338,11 @@
 
 /*
  * This function returns the mount status based upon the path.
  */
 int
-is_mounted(char *path, short *fsys_value)
+is_mounted(char *path, uint32_t *fsys_value)
 {
         if (*fsys_value == BADFSYS)
                 *fsys_value = fsys(path);
 
         return (is_mounted_n(*fsys_value));

@@ -1354,11 +1354,11 @@
  *
  *      Note: Upon exit, a valid fsys() is guaranteed. This is
  *      an interface requirement.
  */
 int
-is_fs_writeable(char *path, short *fsys_value)
+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,11 +1370,11 @@
  *
  *      Also Note: Upon exit, a valid fsys() is guaranteed. This is
  *      an interface requirement.
  */
 int
-is_remote_fs(char *path, short *fsys_value)
+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,11 +1385,11 @@
  * 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)
+is_served(char *path, uint32_t *fsys_value)
 {
         if (*fsys_value == BADFSYS)
                 *fsys_value = fsys(path);
 
         return (is_served_n(*fsys_value));

@@ -1399,11 +1399,11 @@
  * 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)
+get_remote_path(uint32_t n)
 {
         char    *p;
 
         if (!is_remote_fs_n(n))
                 return (NULL);  /* local */

@@ -1419,19 +1419,19 @@
  * 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)
+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(short n)
+get_fs_entry(uint32_t n)
 {
         if (fs_tab_used == 0) {
                 return (NULL);
         } else if (n >= fs_tab_used) {
                 return (NULL);