]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
common:safe_io: create exact and non-exact variant
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Thu, 10 Feb 2011 11:53:25 +0000 (03:53 -0800)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Thu, 10 Feb 2011 12:58:47 +0000 (04:58 -0800)
commita743e314b929cb2da012bb4f76ebf25962583f08
treec659bed9ba35ed86aa22d97398ea7719497a9d36
parent380ccfd76b2aa45d31082e9fa5482e5e84584bf0
common:safe_io: create exact and non-exact variant

Create safe_read_exact, which fails with -EDOM unless it reads exactly
the requested number of bytes. More often, what we want is the
semantics of safe_read, which returns the number of bytes it read, or
negative on error. Likewise for pread.

Write doesn't need variants because failing to write all the bytes is
always an error.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
src/common/safe_io.c
src/common/safe_io.h