Backport changes from the Quamotion repository#18
Conversation
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
left a comment
There was a problem hiding this comment.
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(':')) |
There was a problem hiding this comment.
We risk exceptions here. Right? - the merged[1] part.
There was a problem hiding this comment.
Sure, added a merged.Length > 2 check (to also account for the merged.SubString part on the next line)
There was a problem hiding this comment.
This function in all seems way shorter than the original. Are we certain it produces the same results?
There was a problem hiding this comment.
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:\.
There was a problem hiding this comment.
The original documentation said it would return relative paths in some situations.. This would always return full paths?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
Most likely the line ending
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 ... :)
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Credits go to @zivillian for that - rather impressive additions to the library!
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!