| 998 | when df is invoked with no non-option argument. See below for details. */ |
| 999 | |
| 1000 | static void |
| 1001 | get_dev (char const *device, char const *mount_point, char const *file, |
| 1002 | char const *stat_file, char const *fstype, |
| 1003 | bool me_dummy, bool me_remote, |
| 1004 | const struct fs_usage *force_fsu, |
| 1005 | bool process_all) |
| 1006 | { |
| 1007 | if (me_remote && show_local_fs) |
| 1008 | return; |
| 1009 | |
| 1010 | if (me_dummy && !show_all_fs && !show_listed_fs) |
| 1011 | return; |
| 1012 | |
| 1013 | if (!selected_fstype (fstype) || excluded_fstype (fstype)) |
| 1014 | return; |
| 1015 | |
| 1016 | /* Ignore relative MOUNT_POINTs, which are present for example |
| 1017 | in /proc/mounts on Linux with network namespaces. */ |
| 1018 | if (!force_fsu && ! IS_ABSOLUTE_FILE_NAME (mount_point)) |
| 1019 | return; |
| 1020 | |
| 1021 | if (!stat_file) |
| 1022 | stat_file = mount_point; |
| 1023 | |
| 1024 | struct fs_usage fsu; |
| 1025 | if (force_fsu) |
| 1026 | fsu = *force_fsu; |
| 1027 | else if (get_fs_usage (stat_file, device, &fsu)) |
| 1028 | { |
| 1029 | /* If we can't access a system provided entry due |
| 1030 | to it not being present (now), or due to permissions, |
| 1031 | just output placeholder values rather than failing. */ |
| 1032 | if (process_all && (errno == EACCES || errno == ENOENT)) |
| 1033 | { |
| 1034 | if (! show_all_fs) |
| 1035 | return; |
| 1036 | |
| 1037 | fstype = "-"; |
| 1038 | fsu.fsu_bavail_top_bit_set = false; |
| 1039 | fsu.fsu_blocksize = fsu.fsu_blocks = fsu.fsu_bfree = |
| 1040 | fsu.fsu_bavail = fsu.fsu_files = fsu.fsu_ffree = UINTMAX_MAX; |
| 1041 | } |
| 1042 | else |
| 1043 | { |
| 1044 | error (0, errno, "%s", quotef (stat_file)); |
| 1045 | exit_status = EXIT_FAILURE; |
| 1046 | return; |
| 1047 | } |
| 1048 | } |
| 1049 | else if (process_all && show_all_fs) |
| 1050 | { |
| 1051 | /* Ensure we don't output incorrect stats for over-mounted directories. |
| 1052 | Discard stats when the device name doesn't match. Though don't |
| 1053 | discard when used and current mount entries are both remote due |
| 1054 | to the possibility of aliased host names or exports. */ |
| 1055 | struct stat sb; |
| 1056 | if (stat (stat_file, &sb) == 0) |
| 1057 | { |
no test coverage detected