Skip to content

Backport changes from the Quamotion repository#18

Merged
LordMike merged 6 commits into
DiscUtils:masterfrom
qmfrederik:quamotion
May 1, 2017
Merged

Backport changes from the Quamotion repository#18
LordMike merged 6 commits into
DiscUtils:masterfrom
qmfrederik:quamotion

Conversation

@qmfrederik

Copy link
Copy Markdown
Contributor

A couple of PRs were merged into quamotion/discutils before discutils/discutils was forked; this PR adds those changes back.

Fixes #1

@LordMike Can you have a first look at this and see if there's anything you object to?

Thanks!

Bianco Veigel and others added 5 commits May 1, 2017 20:09
open lvm logical volume
check lvm metadata checksum
* initial XFS implementation

* read XFS AG inode B+tree info

* add xfs B+tree header

* xfs B+tree inode structure

* xfs: read inodes

* xfs read local & extent file content

* xfs: Block Directory structures

* - fixed block directory offsets
- fixed filename encoding
- added B+tree extents
- added support for large directories and heavily fragmented files

* cleanup
* support disk usage for Ntfs
* support disk usage for Fat
* support disk usage for Ext
* parse jbd2 journal superblock to exclude journal size from available size
* use ulong for fs size
* - support ext4 64Bit block groups
- use ext BlockDescriptor to calc free blocks
* add FS Size to base class
remove marker interface
* add size support for Nfs3
* add size support for NativeFileSystem
* fix CLS warning
* add missing file
* cleanup

@LordMike LordMike left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only deletion is the core function to get a base / relative path. That has to keep functioning.

The rest seems fine (glanced across it - it already passed review elsewhere).

merged = @"\\" + merged;
}
else if (basePath.StartsWith(@"\", StringComparison.Ordinal))
if (basePath.StartsWith(@"\") && merged[1].Equals(':'))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We risk exceptions here. Right? - the merged[1] part.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, added a merged.Length > 2 check (to also account for the merged.SubString part on the next line)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function in all seems way shorter than the original. Are we certain it produces the same results?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a lot shorter because it uses Path.GetFullPath to do most of the work instead of doing the work in custom code - so that's what you're seeing here. The only difference with Path.GetFullPath is that the root is always \ instead of e.g. C:\.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original documentation said it would return relative paths in some situations.. This would always return full paths?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the base path is relative, the return value will also be relative. I had a look, this code is mainly used by the Vhd/Vhdx parts which comes from Windows land so Path.GetFullPath should be OK here, plus it was used by @zivillian when he wrote the new code so I think it's safe to guess this is OK.

public static bool Is8Dot3Char(char ch)
{
return (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || "_^$~!#%-{}()@'`&".IndexOf(ch) != -1;
return (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9') || "_^$~!#%£-{}()@'`&".IndexOf(ch) != -1;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What changed here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most likely the line ending

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, it's the encoding of the £ sign which has changed. You can see it in the GitHub notification e-mails, in the original code the £ is not printed, whereas in the updated code it is.

VS complained that some of the files had inconsistent line endings and also saved everything as UTF-8, so I guess that's why it shows up in the Github diff now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed the mail part too - didn't think of it.
The file is UTF-8 now, and the sign is correctly set?

Would suck to suddenly skip a certain character because the source file used a different symbol for it ... :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's UTF-8 now (with BOM) and the £ is uniquely defined in UTF-8. The reason it was mangled in the original e-mail is because the £ sign does not appear in ASCII, so it was encoded using one of the Windows-specific codepages. Should be all good now.

{
MemoryStream ms = new MemoryStream();
XdrDataWriter writer = StartCallMessage(ms, _client.Credentials, 1);
XdrDataWriter writer = StartCallMessage(ms, _client.Credentials, NfsProc3.GetAttr);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great. We love enums 👍

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Credits go to @zivillian for that - rather impressive additions to the library!

@LordMike LordMike merged commit 178f491 into DiscUtils:master May 1, 2017
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
@qmfrederik qmfrederik deleted the quamotion branch December 22, 2017 15:46
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.

4 participants