1
1

- Keep only the _LAST_ entry when reading in output from mount:

On Jaguar / is NFS-mounted over the initially mounted ROOTFS...

This commit was SVN r22662.
Этот коммит содержится в:
Rainer Keller 2010-02-18 18:05:55 +00:00
родитель 6c2c68907c
Коммит 8dd87def77

Просмотреть файл

@ -115,6 +115,7 @@ void get_mounts (int * num_dirs, char ** dirs[], bool * nfs[])
i = 0; i = 0;
rc = 4711; rc = 4711;
while (NULL != fgets (buffer, SIZE, file)) { while (NULL != fgets (buffer, SIZE, file)) {
int mount_known;
char fs[MAXNAMLEN]; char fs[MAXNAMLEN];
dirs_tmp[i] = malloc (MAXNAMLEN); dirs_tmp[i] = malloc (MAXNAMLEN);
@ -130,16 +131,35 @@ void get_mounts (int * num_dirs, char ** dirs[], bool * nfs[])
if (0 == strcasecmp (fs, "rpc_pipefs")) if (0 == strcasecmp (fs, "rpc_pipefs"))
continue; continue;
nfs_tmp[i] = false; /*
* Later mounts override earlier mounts
* (e.g. nfs-mount of /, vs. initial rootfs-mount of /).
*/
for (mount_known = 0; mount_known < i; mount_known++) {
/* If we know this mount-point, then exit early */
if (0 == strcasecmp (dirs_tmp[mount_known], dirs_tmp[i])) {
#ifdef DEBUG
printf ("get_mounts: already know dir[%d]:%s\n",
mount_known, dirs_tmp[mount_known]);
#endif
break;
}
}
nfs_tmp[mount_known] = false;
if (0 == strcasecmp (fs, "nfs") || if (0 == strcasecmp (fs, "nfs") ||
0 == strcasecmp (fs, "lustre") || 0 == strcasecmp (fs, "lustre") ||
0 == strcasecmp (fs, "panfs")) 0 == strcasecmp (fs, "panfs"))
nfs_tmp[i] = true; nfs_tmp[mount_known] = true;
#ifdef DEBUG #ifdef DEBUG
printf ("get_mounts: dirs[%d]:%s fs:%s nfs:%s\n", printf ("get_mounts: dirs[%d]:%s fs:%s nfs:%s\n",
i, dirs_tmp[i], fs, nfs_tmp[i] ? "Yes" : "No"); mount_known, dirs_tmp[mount_known],
fs, nfs_tmp[mount_known] ? "Yes" : "No");
#endif #endif
i++;
if (mount_known >= i)
i++;
} }
out: out:
*num_dirs = i; *num_dirs = i;