Skip to content
This repository has been archived by the owner on Apr 20, 2022. It is now read-only.

General cleanup: added constant for block_size #2

Merged
merged 1 commit into from
Jun 21, 2017

Conversation

GreyCat
Copy link
Contributor

@GreyCat GreyCat commented Jun 20, 2017

  • Moved "4096" to a top-level constant block_size. Use that block_size everywhere applicable.
  • Removed padding from block, as it serves no purpose anyway: the only invocation of block has clear constraint size: block_size, thus block would always be exactly 4096 bytes, no matter what.

`block_size` everywhere applicable.

Removed `padding` from `block`, as it serves no purpose anyway: the
only invocation of `block` has clear constraint `size: block_size`,
thus `block` would always be exactly 4096 bytes, no matter what.
@hddscan
Copy link
Contributor

hddscan commented Jun 20, 2017

I was using the "padding" field here "_parent._parent.header.padding"
Please rename it if you don't like the name. Removing it is not an option.

@cugu
Copy link
Owner

cugu commented Jun 20, 2017

It might be useful for forensics as well. We could call it slack_space.

@GreyCat
Copy link
Contributor Author

GreyCat commented Jun 20, 2017

That's different padding, it's padding from block_header. This commit removes padding from block.

My idea for removing it is that it stays accessible anyway, no information is lost. If anyone wants to examine it, one can always use certain_block._io and read (and do something, i.e. parse) its contents. But it's pointless to just read it into memory "because we can", as it quickly eats up RAM without doing nothing. If we'd want to do a working FS driver from this spec, we'd better avoid wasting RAM like that ;)

@hddscan
Copy link
Contributor

hddscan commented Jun 20, 2017

My mistake. No objections then

@GreyCat
Copy link
Contributor Author

GreyCat commented Jun 20, 2017

@hddscan Checked it again: I agree that padding in block_header certainy needs to be renamed to avoid confusion. It's really weird to apply any logic (i.e. switching) over a "padding", which is "scrap area without any information" by definition.

@cugu cugu merged commit 071c4cf into cugu:master Jun 21, 2017
@cugu cugu mentioned this pull request Jun 21, 2017
cugu pushed a commit that referenced this pull request Sep 13, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants