diff options
author | Jim Meyering <jim@meyering.net> | 2003-02-04 11:48:27 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2003-02-04 11:48:27 +0000 |
commit | e295f4f388d9ab0e0bdafd97c1ac9fc8f38edc5e (patch) | |
tree | 4cde1e9f04780fd50a5c3fd6405740898219b4cb /src | |
parent | 144418cd9db07666edb4b11f21a620a75acce625 (diff) | |
download | coreutils-e295f4f388d9ab0e0bdafd97c1ac9fc8f38edc5e.tar.xz |
`df /dev/block-or-char-device-file--not-mounted' now reports
the name of the file system on which the file resides, usually `/'.
Before, it would leave the `Mounted on' field blank.
(show_disk): Add parameter: STATP.
If we don't find a matching device name, then resort to calling
find_mount_point.
Diffstat (limited to 'src')
-rw-r--r-- | src/df.c | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -504,12 +504,14 @@ done: } /* Identify the directory, if any, that device - DISK is mounted on, and show its disk usage. */ + DISK is mounted on, and show its disk usage. + STATP must be the result of `stat (DISK, STATP)'. */ static void -show_disk (const char *disk) +show_disk (const char *disk, const struct stat *statp) { struct mount_entry *me; + char *mount_point; for (me = mount_list; me; me = me->me_next) if (STREQ (disk, me->me_devname)) @@ -518,13 +520,23 @@ show_disk (const char *disk) me->me_dummy, me->me_remote); return; } + + mount_point = find_mount_point (disk, statp); + if (!mount_point) + { + error (0, errno, "%s", quote (disk)); + exit_status = EXIT_FAILURE; + } + /* No filesystem is mounted on DISK. */ - show_dev (disk, (char *) NULL, (char *) NULL, 0, 0); + show_dev (disk, mount_point, NULL, 0, 0); + if (mount_point) + free (mount_point); } /* Figure out which device file or directory POINT is mounted on and show its disk usage. - STATP is the results of `stat' on POINT. */ + STATP must be the result of `stat (POINT, STATP)'. */ static void show_point (const char *point, const struct stat *statp) { |