summaryrefslogtreecommitdiff
path: root/usr/src/cmd/svr4pkg/libinst
diff options
context:
space:
mode:
authorSimon Klinkert <simon.klinkert@gmail.com>2015-07-16 16:22:52 +0200
committerDan McDonald <danmcd@omniti.com>2015-07-19 15:11:11 -0400
commite47aa97b65b6eaa7016357de7fb7974c1982858c (patch)
treedf1d35f3e507003d320c15482c3d30c8448c15aa /usr/src/cmd/svr4pkg/libinst
parentfdbe01bdc218a1a5d0bb998c40e77e4069330094 (diff)
downloadillumos-joyent-e47aa97b65b6eaa7016357de7fb7974c1982858c.tar.gz
6063 pkgadd breaks with too many mountpoints
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com> Reviewed by: Richard Lowe <richlowe@richlowe.net> Approved by: Dan McDonald <danmcd@omniti.com>
Diffstat (limited to 'usr/src/cmd/svr4pkg/libinst')
-rw-r--r--usr/src/cmd/svr4pkg/libinst/mntinfo.c88
1 files changed, 45 insertions, 43 deletions
diff --git a/usr/src/cmd/svr4pkg/libinst/mntinfo.c b/usr/src/cmd/svr4pkg/libinst/mntinfo.c
index 45a21362e6..67bba5165a 100644
--- a/usr/src/cmd/svr4pkg/libinst/mntinfo.c
+++ b/usr/src/cmd/svr4pkg/libinst/mntinfo.c
@@ -216,7 +216,7 @@ really_write(char *mountpt)
/* 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;
@@ -224,7 +224,7 @@ get_server_host(short n)
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)
@@ -375,8 +375,8 @@ unmount_client()
if (pid_return != pid) {
logerr(WRN_BAD_WAIT, pid, pid_return,
- (unsigned long)status, errno,
- strerror(errno));
+ (unsigned long)status, errno,
+ strerror(errno));
retcode = 0;
}
@@ -390,7 +390,7 @@ unmount_client()
(errcode = WEXITSTATUS(status))) {
retcode = 0;
logerr(WRN_FSTAB_UMOUNT,
- fs_tab[n]->name, errcode);
+ fs_tab[n]->name, errcode);
} else {
fs_tab[n]->cl_mounted = 0;
}
@@ -502,8 +502,8 @@ mount_client()
if (pid_return != pid) {
logerr(WRN_BAD_WAIT, pid, pid_return,
- (unsigned long)status, errno,
- strerror(errno));
+ (unsigned long)status, errno,
+ strerror(errno));
retcode = 0;
}
@@ -566,17 +566,17 @@ mount_client()
* 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));
+ sizeof (server_construction),
+ "%s%s", fs_tab[fsys_value]->remote_name,
+ path+strlen(fs_tab[fsys_value]->name));
} else {
(void) strcpy(server_construction, path);
}
@@ -912,10 +912,10 @@ get_mntinfo(int map_client, char *vfstab_file)
*/
if (vfstab_file) {
(void) snprintf(VFS_TABLE, sizeof (VFS_TABLE), "%s",
- vfstab_file);
+ vfstab_file);
} else {
(void) snprintf(VFS_TABLE, sizeof (VFS_TABLE), "%s%s",
- install_root, VFSTAB);
+ install_root, VFSTAB);
}
if (access(VFS_TABLE, R_OK) == 0) {
@@ -926,7 +926,7 @@ get_mntinfo(int map_client, char *vfstab_file)
*/
if ((pp = setmntent(VFS_TABLE, "r")) == NULL) {
progerr(ERR_NOTABLE, "vfs", VFS_TABLE,
- strerror(errno));
+ strerror(errno));
return (1);
}
@@ -956,8 +956,8 @@ get_mntinfo(int map_client, char *vfstab_file)
install_root);
} else {
(void) snprintf(client_mountp,
- sizeof (client_mountp), "%s%s",
- install_root, vfs->vfs_mountp);
+ sizeof (client_mountp), "%s%s",
+ install_root, vfs->vfs_mountp);
}
/*
@@ -983,8 +983,9 @@ get_mntinfo(int map_client, char *vfstab_file)
is_remote);
} else { /* MNT_NOT */
if (construct_vfs(vfs, client_mountp,
- link_name, is_remote, mnt_stat))
+ link_name, is_remote, mnt_stat)) {
return (1);
+ }
}
}
(void) endmntent(pp);
@@ -1051,7 +1052,7 @@ load_fsentry(struct fstable *fs_entry, char *name, char *fstype,
* refer to other filesystems. It just returns the entry containing this
* path.
*/
-short
+uint32_t
fsys(char *path)
{
register int i;
@@ -1128,8 +1129,9 @@ fsys(char *path)
*/
if ((fs_namelen == 1 && *(fs_tab[i]->name) == '/') ||
((term_char == '/' || term_char == NULL) &&
- strncmp(fs_tab[i]->name, path2use, fs_namelen) == 0))
+ strncmp(fs_tab[i]->name, path2use, fs_namelen) == 0)) {
return (i);
+ }
}
/*
@@ -1147,7 +1149,7 @@ fsys(char *path)
* it will return the filesystem that the loopback filesystem is mounted
* over.
*/
-short
+uint32_t
resolved_fsys(char *path)
{
int i = -1;
@@ -1170,7 +1172,7 @@ resolved_fsys(char *path)
* 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);
}
@@ -1181,7 +1183,7 @@ use_srvr_map_n(short n)
* to this file system.
*/
int
-is_mounted_n(short n)
+is_mounted_n(uint32_t n)
{
return ((int)fs_tab[n]->mounted);
}
@@ -1191,7 +1193,7 @@ is_mounted_n(short n)
* 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
@@ -1217,14 +1219,14 @@ is_fs_writeable_n(short n)
* 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);
}
@@ -1235,7 +1237,7 @@ is_served_n(short n)
* 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);
}
@@ -1246,7 +1248,7 @@ get_blk_free_n(short n)
* 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);
}
@@ -1257,7 +1259,7 @@ get_blk_used_n(short n)
* 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);
}
@@ -1268,7 +1270,7 @@ get_inode_free_n(short n)
* 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);
}
@@ -1279,21 +1281,21 @@ get_inode_used_n(short n)
* 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);
}
@@ -1302,7 +1304,7 @@ get_frag_size_n(short n)
* 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);
@@ -1319,7 +1321,7 @@ get_fs_name_n(short n)
* 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);
}
@@ -1328,7 +1330,7 @@ get_source_name_n(short n)
* 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);
@@ -1340,7 +1342,7 @@ use_srvr_map(char *path, short *fsys_value)
* 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);
@@ -1356,7 +1358,7 @@ is_mounted(char *path, short *fsys_value)
* 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);
@@ -1372,7 +1374,7 @@ is_fs_writeable(char *path, short *fsys_value)
* 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);
@@ -1387,7 +1389,7 @@ is_remote_fs(char *path, short *fsys_value)
* (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);
@@ -1401,7 +1403,7 @@ is_served(char *path, short *fsys_value)
* return NULL if it's a local filesystem.
*/
char *
-get_remote_path(short n)
+get_remote_path(uint32_t n)
{
char *p;
@@ -1421,7 +1423,7 @@ get_remote_path(short n)
* 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 */
@@ -1429,7 +1431,7 @@ get_mount_point(short n)
}
struct fstable *
-get_fs_entry(short n)
+get_fs_entry(uint32_t n)
{
if (fs_tab_used == 0) {
return (NULL);