"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "core-mounts.c" between
stress-ng-0.12.09.tar.xz and stress-ng-0.12.10.tar.xz

About: stress-ng will stress test a computer system in various selectable ways. It was designed to exercise various physical subsystems of a computer as well as the various operating system kernel interfaces.

core-mounts.c  (stress-ng-0.12.09.tar.xz):core-mounts.c  (stress-ng-0.12.10.tar.xz)
skipping to change at line 77 skipping to change at line 77
#if defined(HAVE_GETMNTINFO) #if defined(HAVE_GETMNTINFO)
int stress_mount_get(char *mnts[], const int max) int stress_mount_get(char *mnts[], const int max)
{ {
int i, n = 0, ret; int i, n = 0, ret;
#if defined(__NetBSD__) || defined(__minix__) #if defined(__NetBSD__) || defined(__minix__)
struct statvfs *statbufs; struct statvfs *statbufs;
#else #else
struct statfs *statbufs; struct statfs *statbufs;
#endif #endif
(void)memset(mnts, 0, max * sizeof(char *)); (void)memset(mnts, 0, max * sizeof(*mnts));
ret = getmntinfo(&statbufs, 0); ret = getmntinfo(&statbufs, 0);
if (ret > max) if (ret > max)
ret = max; ret = max;
for (i = 0; i < ret; i++) { for (i = 0; i < ret; i++) {
stress_mount_add(mnts, max, &n, statbufs[i].f_mntonname); stress_mount_add(mnts, max, &n, statbufs[i].f_mntonname);
} }
return ret; return ret;
} }
#elif defined(HAVE_GETMNTENT) && \ #elif defined(HAVE_GETMNTENT) && \
defined(HAVE_MNTENT_H) defined(HAVE_MNTENT_H)
int stress_mount_get(char *mnts[], const int max) int stress_mount_get(char *mnts[], const int max)
{ {
FILE *mounts; FILE *mounts;
struct mntent* mnt; struct mntent* mnt;
int n = 0; int n = 0;
(void)memset(mnts, 0, (size_t)max * sizeof(char *)); (void)memset(mnts, 0, (size_t)max * sizeof(*mnts));
mounts = setmntent("/etc/mtab", "r"); mounts = setmntent("/etc/mtab", "r");
/* Failed, so assume / is available */ /* Failed, so assume / is available */
if (!mounts) { if (!mounts) {
stress_mount_add(mnts, max, &n, "/"); stress_mount_add(mnts, max, &n, "/");
return n; return n;
} }
while ((mnt = getmntent(mounts)) != NULL) while ((mnt = getmntent(mounts)) != NULL)
stress_mount_add(mnts, max, &n, mnt->mnt_dir); stress_mount_add(mnts, max, &n, mnt->mnt_dir);
(void)endmntent(mounts); (void)endmntent(mounts);
return n; return n;
} }
#else #else
int stress_mount_get(char *mnts[], const int max) int stress_mount_get(char *mnts[], const int max)
{ {
int n = 0; int n = 0;
(void)memset(mnts, 0, max * sizeof(char *)); (void)memset(mnts, 0, max * sizeof(*mnts));
stress_mount_add(mnts, max, &n, "/"); stress_mount_add(mnts, max, &n, "/");
stress_mount_add(mnts, max, &n, "/dev"); stress_mount_add(mnts, max, &n, "/dev");
stress_mount_add(mnts, max, &n, "/tmp"); stress_mount_add(mnts, max, &n, "/tmp");
return n; return n;
} }
#endif #endif
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)