Skip to content

Conversation

@djs55
Copy link
Member

@djs55 djs55 commented Mar 6, 2016

  • depend on the logs library, emit logs on errors
  • check that user-supplied buffers satisfy the length constraint, with test case
  • add a test case to cover successfully read back previously-written data

djs55 added 8 commits March 6, 2016 15:35
On fatal errors (i.e. those which return a useless `Error string), we
write a log message. Applications nolonger need to extract the `Error
string and log it themselves.

Signed-off-by: David Scott <dave.scott@docker.com>
Signed-off-by: David Scott <dave.scott@docker.com>
Before this patch we only passed in the filename, for logging
purposes. We want to check alignment invariants, so we will
need the full `t`.

Signed-off-by: David Scott <dave.scott@docker.com>
Since we always used `Log` to log the error, before returning it
as an `Error string, define and use a new function `fatalf` to do
both at once.

Note before we actuallly logged `End_of_file` as "info" but this
was probably a mistake, since it too returned `Error string.

Signed-off-by: David Scott <dave.scott@docker.com>
Before this patch several callers had no buffer to operate on so
they artifically used a length of 0. This patch makes the buffer into
an optional argument so these callers will simply use the default
value of None.

Signed-off-by: David Scott <dave.scott@docker.com>
Before this patch the I/O would fail with an EINVAL, leaving
the developer to wonder what went wrong. This patch logs and
returns a descriptive error message.

Signed-off-by: David Scott <dave.scott@docker.com>
This is a very simple test which writes sectors full of byte x to
sector x for the first 255 sectors, and then reads them back again.

Signed-off-by: David Scott <dave.scott@docker.com>
Buffers should have a length equal to a multiple of sector sizes;
check that errors are returned in this case.

Signed-off-by: David Scott <dave.scott@docker.com>
@djs55
Copy link
Member Author

djs55 commented Mar 6, 2016

I'm expecting appveyor to fail on this build.

@djs55
Copy link
Member Author

djs55 commented Mar 6, 2016

Travis is happy.

djs55 added a commit that referenced this pull request Mar 6, 2016
Use logs, check more interface constraints, add more tests
@djs55 djs55 merged commit 74de10f into mirage:master Mar 6, 2016
@djs55 djs55 deleted the improvements branch March 6, 2016 16:53
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.

1 participant