Eliminate the use of EDOOFUS. The error code was used to signal
programming errors, but is really a poor substitute for assert. And less portable as well.
This commit is contained in:
parent
ee484d5bd3
commit
4039ea7c9b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=306329
@ -456,8 +456,7 @@ image_copyin_mapped(lba_t blk, int fd, uint64_t *sizep)
|
||||
* I don't know what this means or whether it
|
||||
* can happen at all...
|
||||
*/
|
||||
error = EDOOFUS;
|
||||
break;
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
if (error)
|
||||
@ -602,7 +601,7 @@ image_copyout_region(int fd, lba_t blk, lba_t size)
|
||||
error = image_copyout_memory(fd, sz, ch->ch_u.mem.ptr);
|
||||
break;
|
||||
default:
|
||||
return (EDOOFUS);
|
||||
assert(0);
|
||||
}
|
||||
size -= sz;
|
||||
blk += sz / secsz;
|
||||
|
@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/types.h>
|
||||
#include <sys/endian.h>
|
||||
#include <sys/errno.h>
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -102,7 +103,7 @@ qcow_resize(lba_t imgsz, u_int version)
|
||||
clstr_log2sz = QCOW2_CLSTR_LOG2SZ;
|
||||
break;
|
||||
default:
|
||||
return (EDOOFUS);
|
||||
assert(0);
|
||||
}
|
||||
|
||||
imagesz = round_clstr(imgsz * secsz);
|
||||
@ -143,8 +144,7 @@ qcow_write(int fd, u_int version)
|
||||
u_int clstrsz, l1idx, l2idx;
|
||||
int error;
|
||||
|
||||
if (clstr_log2sz == 0)
|
||||
return (EDOOFUS);
|
||||
assert(clstr_log2sz != 0);
|
||||
|
||||
clstrsz = 1U << clstr_log2sz;
|
||||
blk_clstrsz = clstrsz / secsz;
|
||||
@ -203,7 +203,7 @@ qcow_write(int fd, u_int version)
|
||||
be32enc(&hdr->u.v2.refcnt_clstrs, refcnt_clstrs);
|
||||
break;
|
||||
default:
|
||||
return (EDOOFUS);
|
||||
assert(0);
|
||||
}
|
||||
|
||||
if (sparse_write(fd, hdr, clstrsz) < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user