mirror of
https://github.com/ceph/ceph
synced 2025-02-21 18:17:42 +00:00
tools: clean up errors in ceph-objectstore-tool
We use negative error codes everywhere else, should use them here too. Also add a couple of strategically placed prints. Signed-off-by: John Spray <john.spray@redhat.com>
This commit is contained in:
parent
d26086d35a
commit
8e5594da29
@ -23,7 +23,7 @@ int RadosDump::read_super()
|
||||
bytes = ebl.read_fd(file_fd, super_header::FIXED_LENGTH);
|
||||
if ((size_t)bytes != super_header::FIXED_LENGTH) {
|
||||
cerr << "Unexpected EOF" << std::endl;
|
||||
return EFAULT;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
sh.decode(ebliter);
|
||||
@ -43,7 +43,7 @@ int RadosDump::get_header(header *h)
|
||||
bytes = ebl.read_fd(file_fd, sh.header_size);
|
||||
if ((size_t)bytes != sh.header_size) {
|
||||
cerr << "Unexpected EOF" << std::endl;
|
||||
return EFAULT;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
h->decode(ebliter);
|
||||
@ -69,7 +69,7 @@ int RadosDump::get_footer(footer *f)
|
||||
|
||||
if (f->magic != endmagic) {
|
||||
cerr << "Bad footer magic" << std::endl;
|
||||
return EFAULT;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -90,7 +90,7 @@ int RadosDump::read_section(sectiontype_t *type, bufferlist *bl)
|
||||
bytes = bl->read_fd(file_fd, hdr.size);
|
||||
if (bytes != hdr.size) {
|
||||
cerr << "Unexpected EOF" << std::endl;
|
||||
return EFAULT;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
if (hdr.size > 0) {
|
||||
@ -133,7 +133,8 @@ int RadosDump::skip_object(bufferlist &bl)
|
||||
done = true;
|
||||
break;
|
||||
default:
|
||||
return EFAULT;
|
||||
cerr << "Can't skip unknown type: " << type << std::endl;
|
||||
return -EFAULT;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -1120,6 +1120,7 @@ int ObjectStoreTool::do_import(ObjectStore *store, OSDSuperblock& sb,
|
||||
if (ret)
|
||||
return ret;
|
||||
if (type != TYPE_PG_BEGIN) {
|
||||
cerr << "Invalid first section type " << type << std::endl;
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
@ -2298,7 +2299,7 @@ int main(int argc, char **argv)
|
||||
cerr << "do_import threw exception error " << e.what() << std::endl;
|
||||
ret = -EFAULT;
|
||||
}
|
||||
if (ret == EFAULT) {
|
||||
if (ret == -EFAULT) {
|
||||
cerr << "Corrupt input for import" << std::endl;
|
||||
}
|
||||
if (ret == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user