Skip to content

Swap#22

Merged
LordMike merged 8 commits into
DiscUtils:masterfrom
ahdde:Swap
Jun 6, 2017
Merged

Swap#22
LordMike merged 8 commits into
DiscUtils:masterfrom
ahdde:Swap

Conversation

@zivillian

Copy link
Copy Markdown
Contributor

This adds support for detection of Linux Swap filesystems. This is based on the current swap_header definition from linux.

The size support is very basic - all space is reported as being used due to no written indicator of real used pages (only tracked in kernel memory).

Since there is no relad content, the corresponding methods return false and empty results.

@LordMike

LordMike commented May 8, 2017

Copy link
Copy Markdown
Member

Does it even make sense to have swap as a filesystem?

I'm all for parsers and such, so that's a great contribution, but maybe it's more suited as a specific parser rather than a general purpose filesystem implementation?

If we got to the point where all properties and features were mapped, it seems to me that it would just be a load of dummy implementations for the Vfs system and then a few extra methods for reading and writing pages..

@zivillian

Copy link
Copy Markdown
Contributor Author

The idea is to be able to detect whatever is on a given disk or image (and for example render something like this).

Without support for Swap detection, we can't tell if there is something useful on the partition - with swap support we can at least say that it's a valid swap with a given size (which may differ from the partition size - don't know why anyone would do this) and that there may a data loss if someone modifies the content of this partition.

So the idea is to be able to make an informed decision depending on the current content of any disk, partition, image, whatever.

I've added another commit, which removes the dummy implementation and derives directly from VfsReadonlyFileSystem.

@LordMike

Copy link
Copy Markdown
Member

Wouldn't it be better to use the partition table systems (MBR, GPT) and list partitions from there?

Having it as a RO fs is better in any case :)

@qmfrederik any input?

@LordMike

LordMike commented Jun 5, 2017

Copy link
Copy Markdown
Member

@qmfrederik poke?

@qmfrederik

Copy link
Copy Markdown
Contributor

The way I understand this PR is that it allows you to inspect very basic properties of the swap filesystem (basically the header), which complement the information you get from the MBR/GPT.

So there's value in the PR (plus it has a unit test!) which makes say - "why not"?

There does seem to be some overhead in creating a separate NuGet package for just a couple of classes; but that is just a side effect of factoring everything into separate packages, so that should be OK, too.

Net: LGTM :)

@LordMike LordMike merged commit 6a135c7 into DiscUtils:master Jun 6, 2017
@zivillian zivillian deleted the Swap branch June 6, 2017 18:41
LordMike added a commit that referenced this pull request Aug 16, 2017
Includes PRs:
#17, #18, #21, #22, #23, #27, #30, #31, #33, #34, #35, #36, #38, #39, #40, #41, #48, #51, #52, #55, #60
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants