Open karelzak opened 1 year ago
Oh that would be lovely. We're dealing with lots of ntfs3
filesystem driver breakage which only provides further details to the kernel log. From userspace there's not much to see other than generic errno messages.
For UDisks, we were thinking about parsing /dev/kmsg
(https://github.com/storaged-project/udisks/issues/1231) but it would be nice is libmount could provide more context anyway. Haven't checked the new kernel mount API and what exactly does it provide.
The function libmount/src/context_mount.c:mnt_context_get_mount_excode() is backed to generate an error message. Now it's generic for all mount stuff.
Since v2.39, we have multiple syscalls (not only mount(2)), and it would be nice to generate error messages specific to the syscalls. For example, failed fsopen() probably means the specified filesystem does not exist. The failed syscall name and status are stored in libmntcontext->syscall{name, status}.
For code maintenance, the best would be to keep error messages in hookset modules (and very generic fallbacks in mnt_context_get_mount_excode()).
For example, add libmnt_hookset->errcall() and call this function from mnt_context_get_mount_excode() if the mount failed in the hook. It will require to add also libmnt_context->syscall_hookset to remember where it failed. This solution will help us also report usable error messages from extensions like id-mapping, subdir mount, loop dev initialization, etc.