Refactor fstab handling
Needs RevisionPublic

Authored by hallas on Jan 12 2020, 7:43 AM.

Details

Reviewers
bruns
meven
Group Reviewers
Frameworks
Summary

Refactor fstab handling

Splits the fstab/mtab handling code into smaller pieces and allow unit
testing of each one. The reafacting allows us to use the various classes
individually, e.g. use the FilesystemTableParser for parsing any
fstab/mtab style file.

This refactoring is a prerequisite for adding proper support for
fuseiso, since fuseiso maintains it's own mtab file, which we would like
to parse and use.

Test Plan

Unit tests
Tested manually with Plasma Vaults

Diff Detail

Repository
R245 Solid
Branch
fstabhandling_rewrite
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 20996
Build 21014: arc lint + arc unit
hallas created this revision.Jan 12 2020, 7:43 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptJan 12 2020, 7:44 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
hallas requested review of this revision.Jan 12 2020, 7:44 AM

@meven - I am a little unsure if I have broken the fix you have done in commit c97f0b2a3076731b35435f200bd09a22859f3e03 - could you please check?

I have not tested with NFS or SMB mounts.

Finally, I think this code could be moved to a more general library in KDE Frameworks, because it appears that we have this functionality in multiple places. We have at least a partial copy of this in solid/src/solid/devices/backends/hal and probably also other places.

src/solid/devices/backends/fstab/call_system_command.cpp
1

I think the Copyright notice needs to include the original authors of this function

src/solid/devices/backends/fstab/filesystem_table_parser.cpp
2

I think the Copyright notice needs to include the original authors of this function

alexde retitled this revision from Refator fstab handling to Refactor fstab handling.Jan 18 2020, 1:46 PM
bruns requested changes to this revision.Jan 18 2020, 3:55 PM

Moving existing code to new files does not make you the copyright owner.

This revision now requires changes to proceed.Jan 18 2020, 3:55 PM

Moving existing code to new files does not make you the copyright owner.

Yes, sorry about that - I need to fix that. This is just my editor, when I create new files this is the default template. I will make sure to put all the original authors in.

bruns added a comment.Jan 18 2020, 9:35 PM

and this is definitely too much code being moved around. Please split this up into multiple reviews.

You should likely start with the introduction of the FilesystemEntry class, use that from the existing code.

and this is definitely too much code being moved around. Please split this up into multiple reviews.

You should likely start with the introduction of the FilesystemEntry class, use that from the existing code.

Ok I can try ;) But it will take some time to do so.

meven added inline comments.Feb 4 2020, 9:40 AM
autotests/system_filesystem_table_test.cpp
55

Perhaps add a squashfs mount "/dev/loop15 /snap/core/8268 squashfs ro,nodev,relatime 0 0"

src/solid/devices/backends/fstab/system_filesystem_table.cpp
61

Can't you use the new syntax ?

meven added a comment.Oct 13 2021, 7:10 AM

Would be great to continue this.