提交 6daf194d 编写于 作者: M Markus Armbruster 提交者: Stefan Hajnoczi

Strip trailing '\n' from error_report()'s first argument

error_report() prepends location, and appends a newline.  The message
constructed from the arguments should not contain a newline.  Fix the
obvious offenders.
Signed-off-by: NMarkus Armbruster <armbru@redhat.com>
Signed-off-by: NStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
上级 db78ef5b
...@@ -671,7 +671,7 @@ static int block_load(QEMUFile *f, void *opaque, int version_id) ...@@ -671,7 +671,7 @@ static int block_load(QEMUFile *f, void *opaque, int version_id)
bs_prev = bs; bs_prev = bs;
total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS; total_sectors = bdrv_getlength(bs) >> BDRV_SECTOR_BITS;
if (total_sectors <= 0) { if (total_sectors <= 0) {
error_report("Error getting length of block device %s\n", error_report("Error getting length of block device %s",
device_name); device_name);
return -EINVAL; return -EINVAL;
} }
......
...@@ -936,7 +936,7 @@ static int qcow2_create2(const char *filename, int64_t total_size, ...@@ -936,7 +936,7 @@ static int qcow2_create2(const char *filename, int64_t total_size,
(1 << cluster_bits) != cluster_size) (1 << cluster_bits) != cluster_size)
{ {
error_report( error_report(
"Cluster size must be a power of two between %d and %dk\n", "Cluster size must be a power of two between %d and %dk",
1 << MIN_CLUSTER_BITS, 1 << (MAX_CLUSTER_BITS - 10)); 1 << MIN_CLUSTER_BITS, 1 << (MAX_CLUSTER_BITS - 10));
return -EINVAL; return -EINVAL;
} }
......
...@@ -444,7 +444,7 @@ static SheepdogAIOCB *sd_aio_setup(BlockDriverState *bs, QEMUIOVector *qiov, ...@@ -444,7 +444,7 @@ static SheepdogAIOCB *sd_aio_setup(BlockDriverState *bs, QEMUIOVector *qiov,
static int sd_schedule_bh(QEMUBHFunc *cb, SheepdogAIOCB *acb) static int sd_schedule_bh(QEMUBHFunc *cb, SheepdogAIOCB *acb)
{ {
if (acb->bh) { if (acb->bh) {
error_report("bug: %d %d\n", acb->aiocb_type, acb->aiocb_type); error_report("bug: %d %d", acb->aiocb_type, acb->aiocb_type);
return -EIO; return -EIO;
} }
...@@ -592,7 +592,7 @@ static int connect_to_sdog(const char *addr, const char *port) ...@@ -592,7 +592,7 @@ static int connect_to_sdog(const char *addr, const char *port)
ret = getaddrinfo(addr, port, &hints, &res0); ret = getaddrinfo(addr, port, &hints, &res0);
if (ret) { if (ret) {
error_report("unable to get address info %s, %s\n", error_report("unable to get address info %s, %s",
addr, strerror(errno)); addr, strerror(errno));
return -1; return -1;
} }
...@@ -622,7 +622,7 @@ static int connect_to_sdog(const char *addr, const char *port) ...@@ -622,7 +622,7 @@ static int connect_to_sdog(const char *addr, const char *port)
goto success; goto success;
} }
fd = -1; fd = -1;
error_report("failed connect to %s:%s\n", addr, port); error_report("failed connect to %s:%s", addr, port);
success: success:
freeaddrinfo(res0); freeaddrinfo(res0);
return fd; return fd;
...@@ -638,7 +638,7 @@ again: ...@@ -638,7 +638,7 @@ again:
if (errno == EINTR || errno == EAGAIN) { if (errno == EINTR || errno == EAGAIN) {
goto again; goto again;
} }
error_report("failed to recv a rsp, %s\n", strerror(errno)); error_report("failed to recv a rsp, %s", strerror(errno));
return 1; return 1;
} }
...@@ -697,7 +697,7 @@ static int send_req(int sockfd, SheepdogReq *hdr, void *data, ...@@ -697,7 +697,7 @@ static int send_req(int sockfd, SheepdogReq *hdr, void *data,
ret = do_writev(sockfd, iov, sizeof(*hdr) + *wlen, 0); ret = do_writev(sockfd, iov, sizeof(*hdr) + *wlen, 0);
if (ret) { if (ret) {
error_report("failed to send a req, %s\n", strerror(errno)); error_report("failed to send a req, %s", strerror(errno));
ret = -1; ret = -1;
} }
...@@ -717,7 +717,7 @@ static int do_req(int sockfd, SheepdogReq *hdr, void *data, ...@@ -717,7 +717,7 @@ static int do_req(int sockfd, SheepdogReq *hdr, void *data,
ret = do_read(sockfd, hdr, sizeof(*hdr)); ret = do_read(sockfd, hdr, sizeof(*hdr));
if (ret) { if (ret) {
error_report("failed to get a rsp, %s\n", strerror(errno)); error_report("failed to get a rsp, %s", strerror(errno));
ret = -1; ret = -1;
goto out; goto out;
} }
...@@ -729,7 +729,7 @@ static int do_req(int sockfd, SheepdogReq *hdr, void *data, ...@@ -729,7 +729,7 @@ static int do_req(int sockfd, SheepdogReq *hdr, void *data,
if (*rlen) { if (*rlen) {
ret = do_read(sockfd, data, *rlen); ret = do_read(sockfd, data, *rlen);
if (ret) { if (ret) {
error_report("failed to get the data, %s\n", strerror(errno)); error_report("failed to get the data, %s", strerror(errno));
ret = -1; ret = -1;
goto out; goto out;
} }
...@@ -766,7 +766,7 @@ static void send_pending_req(BDRVSheepdogState *s, uint64_t oid, uint32_t id) ...@@ -766,7 +766,7 @@ static void send_pending_req(BDRVSheepdogState *s, uint64_t oid, uint32_t id)
ret = add_aio_request(s, aio_req, acb->qiov->iov, ret = add_aio_request(s, aio_req, acb->qiov->iov,
acb->qiov->niov, 0, acb->aiocb_type); acb->qiov->niov, 0, acb->aiocb_type);
if (ret < 0) { if (ret < 0) {
error_report("add_aio_request is failed\n"); error_report("add_aio_request is failed");
free_aio_req(s, aio_req); free_aio_req(s, aio_req);
if (QLIST_EMPTY(&acb->aioreq_head)) { if (QLIST_EMPTY(&acb->aioreq_head)) {
sd_finish_aiocb(acb); sd_finish_aiocb(acb);
...@@ -799,7 +799,7 @@ static void aio_read_response(void *opaque) ...@@ -799,7 +799,7 @@ static void aio_read_response(void *opaque)
/* read a header */ /* read a header */
ret = do_read(fd, &rsp, sizeof(rsp)); ret = do_read(fd, &rsp, sizeof(rsp));
if (ret) { if (ret) {
error_report("failed to get the header, %s\n", strerror(errno)); error_report("failed to get the header, %s", strerror(errno));
return; return;
} }
...@@ -810,7 +810,7 @@ static void aio_read_response(void *opaque) ...@@ -810,7 +810,7 @@ static void aio_read_response(void *opaque)
} }
} }
if (!aio_req) { if (!aio_req) {
error_report("cannot find aio_req %x\n", rsp.id); error_report("cannot find aio_req %x", rsp.id);
return; return;
} }
...@@ -846,7 +846,7 @@ static void aio_read_response(void *opaque) ...@@ -846,7 +846,7 @@ static void aio_read_response(void *opaque)
ret = do_readv(fd, acb->qiov->iov, rsp.data_length, ret = do_readv(fd, acb->qiov->iov, rsp.data_length,
aio_req->iov_offset); aio_req->iov_offset);
if (ret) { if (ret) {
error_report("failed to get the data, %s\n", strerror(errno)); error_report("failed to get the data, %s", strerror(errno));
return; return;
} }
break; break;
...@@ -854,7 +854,7 @@ static void aio_read_response(void *opaque) ...@@ -854,7 +854,7 @@ static void aio_read_response(void *opaque)
if (rsp.result != SD_RES_SUCCESS) { if (rsp.result != SD_RES_SUCCESS) {
acb->ret = -EIO; acb->ret = -EIO;
error_report("%s\n", sd_strerror(rsp.result)); error_report("%s", sd_strerror(rsp.result));
} }
rest = free_aio_req(s, aio_req); rest = free_aio_req(s, aio_req);
...@@ -911,7 +911,7 @@ static int get_sheep_fd(BDRVSheepdogState *s) ...@@ -911,7 +911,7 @@ static int get_sheep_fd(BDRVSheepdogState *s)
fd = connect_to_sdog(s->addr, s->port); fd = connect_to_sdog(s->addr, s->port);
if (fd < 0) { if (fd < 0) {
error_report("%s\n", strerror(errno)); error_report("%s", strerror(errno));
return -1; return -1;
} }
...@@ -919,7 +919,7 @@ static int get_sheep_fd(BDRVSheepdogState *s) ...@@ -919,7 +919,7 @@ static int get_sheep_fd(BDRVSheepdogState *s)
ret = set_nodelay(fd); ret = set_nodelay(fd);
if (ret) { if (ret) {
error_report("%s\n", strerror(errno)); error_report("%s", strerror(errno));
closesocket(fd); closesocket(fd);
return -1; return -1;
} }
...@@ -1035,7 +1035,7 @@ static int find_vdi_name(BDRVSheepdogState *s, char *filename, uint32_t snapid, ...@@ -1035,7 +1035,7 @@ static int find_vdi_name(BDRVSheepdogState *s, char *filename, uint32_t snapid,
} }
if (rsp->result != SD_RES_SUCCESS) { if (rsp->result != SD_RES_SUCCESS) {
error_report("cannot get vdi info, %s, %s %d %s\n", error_report("cannot get vdi info, %s, %s %d %s",
sd_strerror(rsp->result), filename, snapid, tag); sd_strerror(rsp->result), filename, snapid, tag);
ret = -1; ret = -1;
goto out; goto out;
...@@ -1063,7 +1063,7 @@ static int add_aio_request(BDRVSheepdogState *s, AIOReq *aio_req, ...@@ -1063,7 +1063,7 @@ static int add_aio_request(BDRVSheepdogState *s, AIOReq *aio_req,
uint64_t old_oid = aio_req->base_oid; uint64_t old_oid = aio_req->base_oid;
if (!nr_copies) { if (!nr_copies) {
error_report("bug\n"); error_report("bug");
} }
memset(&hdr, 0, sizeof(hdr)); memset(&hdr, 0, sizeof(hdr));
...@@ -1096,14 +1096,14 @@ static int add_aio_request(BDRVSheepdogState *s, AIOReq *aio_req, ...@@ -1096,14 +1096,14 @@ static int add_aio_request(BDRVSheepdogState *s, AIOReq *aio_req,
/* send a header */ /* send a header */
ret = do_write(s->fd, &hdr, sizeof(hdr)); ret = do_write(s->fd, &hdr, sizeof(hdr));
if (ret) { if (ret) {
error_report("failed to send a req, %s\n", strerror(errno)); error_report("failed to send a req, %s", strerror(errno));
return -EIO; return -EIO;
} }
if (wlen) { if (wlen) {
ret = do_writev(s->fd, iov, wlen, aio_req->iov_offset); ret = do_writev(s->fd, iov, wlen, aio_req->iov_offset);
if (ret) { if (ret) {
error_report("failed to send a data, %s\n", strerror(errno)); error_report("failed to send a data, %s", strerror(errno));
return -EIO; return -EIO;
} }
} }
...@@ -1145,7 +1145,7 @@ static int read_write_object(int fd, char *buf, uint64_t oid, int copies, ...@@ -1145,7 +1145,7 @@ static int read_write_object(int fd, char *buf, uint64_t oid, int copies,
ret = do_req(fd, (SheepdogReq *)&hdr, buf, &wlen, &rlen); ret = do_req(fd, (SheepdogReq *)&hdr, buf, &wlen, &rlen);
if (ret) { if (ret) {
error_report("failed to send a request to the sheep\n"); error_report("failed to send a request to the sheep");
return -1; return -1;
} }
...@@ -1153,7 +1153,7 @@ static int read_write_object(int fd, char *buf, uint64_t oid, int copies, ...@@ -1153,7 +1153,7 @@ static int read_write_object(int fd, char *buf, uint64_t oid, int copies,
case SD_RES_SUCCESS: case SD_RES_SUCCESS:
return 0; return 0;
default: default:
error_report("%s\n", sd_strerror(rsp->result)); error_report("%s", sd_strerror(rsp->result));
return -1; return -1;
} }
} }
...@@ -1206,7 +1206,7 @@ static int sd_open(BlockDriverState *bs, const char *filename, int flags) ...@@ -1206,7 +1206,7 @@ static int sd_open(BlockDriverState *bs, const char *filename, int flags)
fd = connect_to_sdog(s->addr, s->port); fd = connect_to_sdog(s->addr, s->port);
if (fd < 0) { if (fd < 0) {
error_report("failed to connect\n"); error_report("failed to connect");
goto out; goto out;
} }
...@@ -1275,7 +1275,7 @@ static int do_sd_create(char *filename, int64_t vdi_size, ...@@ -1275,7 +1275,7 @@ static int do_sd_create(char *filename, int64_t vdi_size,
} }
if (rsp->result != SD_RES_SUCCESS) { if (rsp->result != SD_RES_SUCCESS) {
error_report("%s, %s\n", sd_strerror(rsp->result), filename); error_report("%s, %s", sd_strerror(rsp->result), filename);
return -EIO; return -EIO;
} }
...@@ -1302,7 +1302,7 @@ static int sd_create(const char *filename, QEMUOptionParameter *options) ...@@ -1302,7 +1302,7 @@ static int sd_create(const char *filename, QEMUOptionParameter *options)
memset(vdi, 0, sizeof(vdi)); memset(vdi, 0, sizeof(vdi));
memset(tag, 0, sizeof(tag)); memset(tag, 0, sizeof(tag));
if (parse_vdiname(&s, filename, vdi, &snapid, tag) < 0) { if (parse_vdiname(&s, filename, vdi, &snapid, tag) < 0) {
error_report("invalid filename\n"); error_report("invalid filename");
return -EINVAL; return -EINVAL;
} }
...@@ -1316,7 +1316,7 @@ static int sd_create(const char *filename, QEMUOptionParameter *options) ...@@ -1316,7 +1316,7 @@ static int sd_create(const char *filename, QEMUOptionParameter *options)
} }
if (vdi_size > SD_MAX_VDI_SIZE) { if (vdi_size > SD_MAX_VDI_SIZE) {
error_report("too big image size\n"); error_report("too big image size");
return -EINVAL; return -EINVAL;
} }
...@@ -1328,7 +1328,7 @@ static int sd_create(const char *filename, QEMUOptionParameter *options) ...@@ -1328,7 +1328,7 @@ static int sd_create(const char *filename, QEMUOptionParameter *options)
/* Currently, only Sheepdog backing image is supported. */ /* Currently, only Sheepdog backing image is supported. */
drv = bdrv_find_protocol(backing_file); drv = bdrv_find_protocol(backing_file);
if (!drv || strcmp(drv->protocol_name, "sheepdog") != 0) { if (!drv || strcmp(drv->protocol_name, "sheepdog") != 0) {
error_report("backing_file must be a sheepdog image\n"); error_report("backing_file must be a sheepdog image");
return -EINVAL; return -EINVAL;
} }
...@@ -1339,7 +1339,7 @@ static int sd_create(const char *filename, QEMUOptionParameter *options) ...@@ -1339,7 +1339,7 @@ static int sd_create(const char *filename, QEMUOptionParameter *options)
s = bs->opaque; s = bs->opaque;
if (!is_snapshot(&s->inode)) { if (!is_snapshot(&s->inode)) {
error_report("cannot clone from a non snapshot vdi\n"); error_report("cannot clone from a non snapshot vdi");
bdrv_delete(bs); bdrv_delete(bs);
return -EINVAL; return -EINVAL;
} }
...@@ -1379,7 +1379,7 @@ static void sd_close(BlockDriverState *bs) ...@@ -1379,7 +1379,7 @@ static void sd_close(BlockDriverState *bs)
if (!ret && rsp->result != SD_RES_SUCCESS && if (!ret && rsp->result != SD_RES_SUCCESS &&
rsp->result != SD_RES_VDI_NOT_LOCKED) { rsp->result != SD_RES_VDI_NOT_LOCKED) {
error_report("%s, %s\n", sd_strerror(rsp->result), s->name); error_report("%s, %s", sd_strerror(rsp->result), s->name);
} }
qemu_aio_set_fd_handler(s->fd, NULL, NULL, NULL, NULL, NULL); qemu_aio_set_fd_handler(s->fd, NULL, NULL, NULL, NULL, NULL);
...@@ -1401,10 +1401,10 @@ static int sd_truncate(BlockDriverState *bs, int64_t offset) ...@@ -1401,10 +1401,10 @@ static int sd_truncate(BlockDriverState *bs, int64_t offset)
unsigned int datalen; unsigned int datalen;
if (offset < s->inode.vdi_size) { if (offset < s->inode.vdi_size) {
error_report("shrinking is not supported\n"); error_report("shrinking is not supported");
return -EINVAL; return -EINVAL;
} else if (offset > SD_MAX_VDI_SIZE) { } else if (offset > SD_MAX_VDI_SIZE) {
error_report("too big image size\n"); error_report("too big image size");
return -EINVAL; return -EINVAL;
} }
...@@ -1421,7 +1421,7 @@ static int sd_truncate(BlockDriverState *bs, int64_t offset) ...@@ -1421,7 +1421,7 @@ static int sd_truncate(BlockDriverState *bs, int64_t offset)
close(fd); close(fd);
if (ret < 0) { if (ret < 0) {
error_report("failed to update an inode.\n"); error_report("failed to update an inode.");
return -EIO; return -EIO;
} }
...@@ -1494,7 +1494,7 @@ static int sd_create_branch(BDRVSheepdogState *s) ...@@ -1494,7 +1494,7 @@ static int sd_create_branch(BDRVSheepdogState *s)
fd = connect_to_sdog(s->addr, s->port); fd = connect_to_sdog(s->addr, s->port);
if (fd < 0) { if (fd < 0) {
error_report("failed to connect\n"); error_report("failed to connect");
goto out; goto out;
} }
...@@ -1612,7 +1612,7 @@ static void sd_readv_writev_bh_cb(void *p) ...@@ -1612,7 +1612,7 @@ static void sd_readv_writev_bh_cb(void *p)
ret = add_aio_request(s, aio_req, acb->qiov->iov, acb->qiov->niov, ret = add_aio_request(s, aio_req, acb->qiov->iov, acb->qiov->niov,
create, acb->aiocb_type); create, acb->aiocb_type);
if (ret < 0) { if (ret < 0) {
error_report("add_aio_request is failed\n"); error_report("add_aio_request is failed");
free_aio_req(s, aio_req); free_aio_req(s, aio_req);
acb->ret = -EIO; acb->ret = -EIO;
goto out; goto out;
...@@ -1689,7 +1689,7 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info) ...@@ -1689,7 +1689,7 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
if (s->is_snapshot) { if (s->is_snapshot) {
error_report("You can't create a snapshot of a snapshot VDI, " error_report("You can't create a snapshot of a snapshot VDI, "
"%s (%" PRIu32 ").\n", s->name, s->inode.vdi_id); "%s (%" PRIu32 ").", s->name, s->inode.vdi_id);
return -EINVAL; return -EINVAL;
} }
...@@ -1712,7 +1712,7 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info) ...@@ -1712,7 +1712,7 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
ret = write_object(fd, (char *)&s->inode, vid_to_vdi_oid(s->inode.vdi_id), ret = write_object(fd, (char *)&s->inode, vid_to_vdi_oid(s->inode.vdi_id),
s->inode.nr_copies, datalen, 0, 0); s->inode.nr_copies, datalen, 0, 0);
if (ret < 0) { if (ret < 0) {
error_report("failed to write snapshot's inode.\n"); error_report("failed to write snapshot's inode.");
ret = -EIO; ret = -EIO;
goto cleanup; goto cleanup;
} }
...@@ -1720,7 +1720,7 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info) ...@@ -1720,7 +1720,7 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
ret = do_sd_create(s->name, s->inode.vdi_size, s->inode.vdi_id, &new_vid, 1, ret = do_sd_create(s->name, s->inode.vdi_size, s->inode.vdi_id, &new_vid, 1,
s->addr, s->port); s->addr, s->port);
if (ret < 0) { if (ret < 0) {
error_report("failed to create inode for snapshot. %s\n", error_report("failed to create inode for snapshot. %s",
strerror(errno)); strerror(errno));
ret = -EIO; ret = -EIO;
goto cleanup; goto cleanup;
...@@ -1732,7 +1732,7 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info) ...@@ -1732,7 +1732,7 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
s->inode.nr_copies, datalen, 0); s->inode.nr_copies, datalen, 0);
if (ret < 0) { if (ret < 0) {
error_report("failed to read new inode info. %s\n", strerror(errno)); error_report("failed to read new inode info. %s", strerror(errno));
ret = -EIO; ret = -EIO;
goto cleanup; goto cleanup;
} }
...@@ -1771,14 +1771,14 @@ static int sd_snapshot_goto(BlockDriverState *bs, const char *snapshot_id) ...@@ -1771,14 +1771,14 @@ static int sd_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
ret = find_vdi_name(s, vdi, snapid, tag, &vid, 1); ret = find_vdi_name(s, vdi, snapid, tag, &vid, 1);
if (ret) { if (ret) {
error_report("Failed to find_vdi_name\n"); error_report("Failed to find_vdi_name");
ret = -ENOENT; ret = -ENOENT;
goto out; goto out;
} }
fd = connect_to_sdog(s->addr, s->port); fd = connect_to_sdog(s->addr, s->port);
if (fd < 0) { if (fd < 0) {
error_report("failed to connect\n"); error_report("failed to connect");
goto out; goto out;
} }
...@@ -1796,7 +1796,7 @@ static int sd_snapshot_goto(BlockDriverState *bs, const char *snapshot_id) ...@@ -1796,7 +1796,7 @@ static int sd_snapshot_goto(BlockDriverState *bs, const char *snapshot_id)
memcpy(&s->inode, buf, sizeof(s->inode)); memcpy(&s->inode, buf, sizeof(s->inode));
if (!s->inode.vm_state_size) { if (!s->inode.vm_state_size) {
error_report("Invalid snapshot\n"); error_report("Invalid snapshot");
ret = -ENOENT; ret = -ENOENT;
goto out; goto out;
} }
...@@ -1813,7 +1813,7 @@ out: ...@@ -1813,7 +1813,7 @@ out:
qemu_free(buf); qemu_free(buf);
qemu_free(old_s); qemu_free(old_s);
error_report("failed to open. recover old bdrv_sd_state.\n"); error_report("failed to open. recover old bdrv_sd_state.");
return ret; return ret;
} }
...@@ -1868,7 +1868,7 @@ static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab) ...@@ -1868,7 +1868,7 @@ static int sd_snapshot_list(BlockDriverState *bs, QEMUSnapshotInfo **psn_tab)
fd = connect_to_sdog(s->addr, s->port); fd = connect_to_sdog(s->addr, s->port);
if (fd < 0) { if (fd < 0) {
error_report("failed to connect\n"); error_report("failed to connect");
goto out; goto out;
} }
...@@ -1942,7 +1942,7 @@ static int do_load_save_vmstate(BDRVSheepdogState *s, uint8_t *data, ...@@ -1942,7 +1942,7 @@ static int do_load_save_vmstate(BDRVSheepdogState *s, uint8_t *data,
} }
if (ret < 0) { if (ret < 0) {
error_report("failed to save vmstate %s\n", strerror(errno)); error_report("failed to save vmstate %s", strerror(errno));
ret = -EIO; ret = -EIO;
goto cleanup; goto cleanup;
} }
......
...@@ -234,20 +234,20 @@ static void minimac2_tx(MilkymistMinimac2State *s) ...@@ -234,20 +234,20 @@ static void minimac2_tx(MilkymistMinimac2State *s)
uint8_t *buf = s->tx_buf; uint8_t *buf = s->tx_buf;
if (txcount < 64) { if (txcount < 64) {
error_report("milkymist_minimac2: ethernet frame too small (%u < %u)\n", error_report("milkymist_minimac2: ethernet frame too small (%u < %u)",
txcount, 64); txcount, 64);
goto err; goto err;
} }
if (txcount > MINIMAC2_MTU) { if (txcount > MINIMAC2_MTU) {
error_report("milkymist_minimac2: MTU exceeded (%u > %u)\n", error_report("milkymist_minimac2: MTU exceeded (%u > %u)",
txcount, MINIMAC2_MTU); txcount, MINIMAC2_MTU);
goto err; goto err;
} }
if (memcmp(buf, preamble_sfd, 8) != 0) { if (memcmp(buf, preamble_sfd, 8) != 0) {
error_report("milkymist_minimac2: frame doesn't contain the preamble " error_report("milkymist_minimac2: frame doesn't contain the preamble "
"and/or the SFD (%02x %02x %02x %02x %02x %02x %02x %02x)\n", "and/or the SFD (%02x %02x %02x %02x %02x %02x %02x %02x)",
buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]); buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
goto err; goto err;
} }
......
...@@ -301,7 +301,7 @@ static int pfpu_decode_insn(MilkymistPFPUState *s) ...@@ -301,7 +301,7 @@ static int pfpu_decode_insn(MilkymistPFPUState *s)
} break; } break;
default: default:
error_report("milkymist_pfpu: unknown opcode %d\n", op); error_report("milkymist_pfpu: unknown opcode %d", op);
break; break;
} }
...@@ -358,7 +358,7 @@ static void pfpu_start(MilkymistPFPUState *s) ...@@ -358,7 +358,7 @@ static void pfpu_start(MilkymistPFPUState *s)
/* decode at most MICROCODE_WORDS instructions */ /* decode at most MICROCODE_WORDS instructions */
if (i++ >= MICROCODE_WORDS) { if (i++ >= MICROCODE_WORDS) {
error_report("milkymist_pfpu: too many instructions " error_report("milkymist_pfpu: too many instructions "
"executed in microcode. No VECTOUT?\n"); "executed in microcode. No VECTOUT?");
break; break;
} }
} }
......
...@@ -131,7 +131,7 @@ static inline void softusb_read_dmem(MilkymistSoftUsbState *s, ...@@ -131,7 +131,7 @@ static inline void softusb_read_dmem(MilkymistSoftUsbState *s,
{ {
if (offset + len >= s->dmem_size) { if (offset + len >= s->dmem_size) {
error_report("milkymist_softusb: read dmem out of bounds " error_report("milkymist_softusb: read dmem out of bounds "
"at offset 0x%x, len %d\n", offset, len); "at offset 0x%x, len %d", offset, len);
return; return;
} }
...@@ -143,7 +143,7 @@ static inline void softusb_write_dmem(MilkymistSoftUsbState *s, ...@@ -143,7 +143,7 @@ static inline void softusb_write_dmem(MilkymistSoftUsbState *s,
{ {
if (offset + len >= s->dmem_size) { if (offset + len >= s->dmem_size) {
error_report("milkymist_softusb: write dmem out of bounds " error_report("milkymist_softusb: write dmem out of bounds "
"at offset 0x%x, len %d\n", offset, len); "at offset 0x%x, len %d", offset, len);
return; return;
} }
...@@ -155,7 +155,7 @@ static inline void softusb_read_pmem(MilkymistSoftUsbState *s, ...@@ -155,7 +155,7 @@ static inline void softusb_read_pmem(MilkymistSoftUsbState *s,
{ {
if (offset + len >= s->pmem_size) { if (offset + len >= s->pmem_size) {
error_report("milkymist_softusb: read pmem out of bounds " error_report("milkymist_softusb: read pmem out of bounds "
"at offset 0x%x, len %d\n", offset, len); "at offset 0x%x, len %d", offset, len);
return; return;
} }
...@@ -167,7 +167,7 @@ static inline void softusb_write_pmem(MilkymistSoftUsbState *s, ...@@ -167,7 +167,7 @@ static inline void softusb_write_pmem(MilkymistSoftUsbState *s,
{ {
if (offset + len >= s->pmem_size) { if (offset + len >= s->pmem_size) {
error_report("milkymist_softusb: write pmem out of bounds " error_report("milkymist_softusb: write pmem out of bounds "
"at offset 0x%x, len %d\n", offset, len); "at offset 0x%x, len %d", offset, len);
return; return;
} }
......
...@@ -352,21 +352,21 @@ static uint32_t tmu2_read(void *opaque, target_phys_addr_t addr) ...@@ -352,21 +352,21 @@ static uint32_t tmu2_read(void *opaque, target_phys_addr_t addr)
static void tmu2_check_registers(MilkymistTMU2State *s) static void tmu2_check_registers(MilkymistTMU2State *s)
{ {
if (s->regs[R_BRIGHTNESS] > MAX_BRIGHTNESS) { if (s->regs[R_BRIGHTNESS] > MAX_BRIGHTNESS) {
error_report("milkymist_tmu2: max brightness is %d\n", MAX_BRIGHTNESS); error_report("milkymist_tmu2: max brightness is %d", MAX_BRIGHTNESS);
} }
if (s->regs[R_ALPHA] > MAX_ALPHA) { if (s->regs[R_ALPHA] > MAX_ALPHA) {
error_report("milkymist_tmu2: max alpha is %d\n", MAX_ALPHA); error_report("milkymist_tmu2: max alpha is %d", MAX_ALPHA);
} }
if (s->regs[R_VERTICESADDR] & 0x07) { if (s->regs[R_VERTICESADDR] & 0x07) {
error_report("milkymist_tmu2: vertex mesh address has to be 64-bit " error_report("milkymist_tmu2: vertex mesh address has to be 64-bit "
"aligned\n"); "aligned");
} }
if (s->regs[R_TEXFBUF] & 0x01) { if (s->regs[R_TEXFBUF] & 0x01) {
error_report("milkymist_tmu2: texture buffer address has to be " error_report("milkymist_tmu2: texture buffer address has to be "
"16-bit aligned\n"); "16-bit aligned");
} }
} }
......
...@@ -371,7 +371,7 @@ void qdev_init_nofail(DeviceState *dev) ...@@ -371,7 +371,7 @@ void qdev_init_nofail(DeviceState *dev)
DeviceInfo *info = dev->info; DeviceInfo *info = dev->info;
if (qdev_init(dev) < 0) { if (qdev_init(dev) < 0) {
error_report("Initialization of device %s failed\n", info->name); error_report("Initialization of device %s failed", info->name);
exit(1); exit(1);
} }
} }
......
...@@ -1536,14 +1536,14 @@ StrongARMState *sa1110_init(unsigned int sdram_size, const char *rev) ...@@ -1536,14 +1536,14 @@ StrongARMState *sa1110_init(unsigned int sdram_size, const char *rev)
} }
if (strncmp(rev, "sa1110", 6)) { if (strncmp(rev, "sa1110", 6)) {
error_report("Machine requires a SA1110 processor.\n"); error_report("Machine requires a SA1110 processor.");
exit(1); exit(1);
} }
s->env = cpu_init(rev); s->env = cpu_init(rev);
if (!s->env) { if (!s->env) {
error_report("Unable to find CPU definition\n"); error_report("Unable to find CPU definition");
exit(1); exit(1);
} }
......
...@@ -1240,7 +1240,7 @@ static int ccid_card_init(DeviceState *qdev, DeviceInfo *base) ...@@ -1240,7 +1240,7 @@ static int ccid_card_init(DeviceState *qdev, DeviceInfo *base)
return -1; return -1;
} }
if (s->card != NULL) { if (s->card != NULL) {
error_report("Warning: usb-ccid card already full, not adding\n"); error_report("Warning: usb-ccid card already full, not adding");
return -1; return -1;
} }
ret = info->initfn ? info->initfn(card) : ret; ret = info->initfn ? info->initfn(card) : ret;
......
...@@ -337,7 +337,7 @@ static void handle_control_message(VirtIOSerial *vser, void *buf, size_t len) ...@@ -337,7 +337,7 @@ static void handle_control_message(VirtIOSerial *vser, void *buf, size_t len)
switch(cpkt.event) { switch(cpkt.event) {
case VIRTIO_CONSOLE_DEVICE_READY: case VIRTIO_CONSOLE_DEVICE_READY:
if (!cpkt.value) { if (!cpkt.value) {
error_report("virtio-serial-bus: Guest failure in adding device %s\n", error_report("virtio-serial-bus: Guest failure in adding device %s",
vser->bus.qbus.name); vser->bus.qbus.name);
break; break;
} }
...@@ -352,7 +352,7 @@ static void handle_control_message(VirtIOSerial *vser, void *buf, size_t len) ...@@ -352,7 +352,7 @@ static void handle_control_message(VirtIOSerial *vser, void *buf, size_t len)
case VIRTIO_CONSOLE_PORT_READY: case VIRTIO_CONSOLE_PORT_READY:
if (!cpkt.value) { if (!cpkt.value) {
error_report("virtio-serial-bus: Guest failure in adding port %u for device %s\n", error_report("virtio-serial-bus: Guest failure in adding port %u for device %s",
port->id, vser->bus.qbus.name); port->id, vser->bus.qbus.name);
break; break;
} }
...@@ -741,7 +741,7 @@ static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base) ...@@ -741,7 +741,7 @@ static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base)
plugging_port0 = info->is_console && !find_port_by_id(port->vser, 0); plugging_port0 = info->is_console && !find_port_by_id(port->vser, 0);
if (find_port_by_id(port->vser, port->id)) { if (find_port_by_id(port->vser, port->id)) {
error_report("virtio-serial-bus: A port already exists at id %u\n", error_report("virtio-serial-bus: A port already exists at id %u",
port->id); port->id);
return -1; return -1;
} }
...@@ -752,7 +752,7 @@ static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base) ...@@ -752,7 +752,7 @@ static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base)
} else { } else {
port->id = find_free_port_id(port->vser); port->id = find_free_port_id(port->vser);
if (port->id == VIRTIO_CONSOLE_BAD_ID) { if (port->id == VIRTIO_CONSOLE_BAD_ID) {
error_report("virtio-serial-bus: Maximum port limit for this device reached\n"); error_report("virtio-serial-bus: Maximum port limit for this device reached");
return -1; return -1;
} }
} }
...@@ -760,7 +760,7 @@ static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base) ...@@ -760,7 +760,7 @@ static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base)
max_nr_ports = tswap32(port->vser->config.max_nr_ports); max_nr_ports = tswap32(port->vser->config.max_nr_ports);
if (port->id >= max_nr_ports) { if (port->id >= max_nr_ports) {
error_report("virtio-serial-bus: Out-of-range port id specified, max. allowed: %u\n", error_report("virtio-serial-bus: Out-of-range port id specified, max. allowed: %u",
max_nr_ports - 1); max_nr_ports - 1);
return -1; return -1;
} }
......
...@@ -797,7 +797,7 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f) ...@@ -797,7 +797,7 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f)
/* Check it isn't doing very strange things with descriptor numbers. */ /* Check it isn't doing very strange things with descriptor numbers. */
if (nheads > vdev->vq[i].vring.num) { if (nheads > vdev->vq[i].vring.num) {
error_report("VQ %d size 0x%x Guest index 0x%x " error_report("VQ %d size 0x%x Guest index 0x%x "
"inconsistent with Host index 0x%x: delta 0x%x\n", "inconsistent with Host index 0x%x: delta 0x%x",
i, vdev->vq[i].vring.num, i, vdev->vq[i].vring.num,
vring_avail_idx(&vdev->vq[i]), vring_avail_idx(&vdev->vq[i]),
vdev->vq[i].last_avail_idx, nheads); vdev->vq[i].last_avail_idx, nheads);
...@@ -805,7 +805,7 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f) ...@@ -805,7 +805,7 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f)
} }
} else if (vdev->vq[i].last_avail_idx) { } else if (vdev->vq[i].last_avail_idx) {
error_report("VQ %d address 0x0 " error_report("VQ %d address 0x0 "
"inconsistent with Host index 0x%x\n", "inconsistent with Host index 0x%x",
i, vdev->vq[i].last_avail_idx); i, vdev->vq[i].last_avail_idx);
return -1; return -1;
} }
......
...@@ -710,7 +710,7 @@ int qemu_find_nic_model(NICInfo *nd, const char * const *models, ...@@ -710,7 +710,7 @@ int qemu_find_nic_model(NICInfo *nd, const char * const *models,
return i; return i;
} }
error_report("qemu: Unsupported NIC model: %s", nd->model); error_report("Unsupported NIC model: %s", nd->model);
return -1; return -1;
} }
......
...@@ -530,7 +530,7 @@ int net_init_socket(QemuOpts *opts, ...@@ -530,7 +530,7 @@ int net_init_socket(QemuOpts *opts,
qemu_opt_get(opts, "connect") || qemu_opt_get(opts, "connect") ||
qemu_opt_get(opts, "mcast") || qemu_opt_get(opts, "mcast") ||
qemu_opt_get(opts, "localaddr")) { qemu_opt_get(opts, "localaddr")) {
error_report("listen=, connect=, mcast= and localaddr= is invalid with fd=\n"); error_report("listen=, connect=, mcast= and localaddr= is invalid with fd=");
return -1; return -1;
} }
...@@ -550,7 +550,7 @@ int net_init_socket(QemuOpts *opts, ...@@ -550,7 +550,7 @@ int net_init_socket(QemuOpts *opts,
qemu_opt_get(opts, "connect") || qemu_opt_get(opts, "connect") ||
qemu_opt_get(opts, "mcast") || qemu_opt_get(opts, "mcast") ||
qemu_opt_get(opts, "localaddr")) { qemu_opt_get(opts, "localaddr")) {
error_report("fd=, connect=, mcast= and localaddr= is invalid with listen=\n"); error_report("fd=, connect=, mcast= and localaddr= is invalid with listen=");
return -1; return -1;
} }
...@@ -566,7 +566,7 @@ int net_init_socket(QemuOpts *opts, ...@@ -566,7 +566,7 @@ int net_init_socket(QemuOpts *opts,
qemu_opt_get(opts, "listen") || qemu_opt_get(opts, "listen") ||
qemu_opt_get(opts, "mcast") || qemu_opt_get(opts, "mcast") ||
qemu_opt_get(opts, "localaddr")) { qemu_opt_get(opts, "localaddr")) {
error_report("fd=, listen=, mcast= and localaddr= is invalid with connect=\n"); error_report("fd=, listen=, mcast= and localaddr= is invalid with connect=");
return -1; return -1;
} }
......
...@@ -193,6 +193,8 @@ void error_print_loc(void) ...@@ -193,6 +193,8 @@ void error_print_loc(void)
/* /*
* Print an error message to current monitor if we have one, else to stderr. * Print an error message to current monitor if we have one, else to stderr.
* Format arguments like sprintf(). The result should not contain
* newlines.
* Prepend the current location and append a newline. * Prepend the current location and append a newline.
* It's wrong to call this in a QMP monitor. Use qerror_report() there. * It's wrong to call this in a QMP monitor. Use qerror_report() there.
*/ */
......
...@@ -690,12 +690,12 @@ static int img_convert(int argc, char **argv) ...@@ -690,12 +690,12 @@ static int img_convert(int argc, char **argv)
if (snapshot_name != NULL) { if (snapshot_name != NULL) {
if (bs_n > 1) { if (bs_n > 1) {
error_report("No support for concatenating multiple snapshot\n"); error_report("No support for concatenating multiple snapshot");
ret = -1; ret = -1;
goto out; goto out;
} }
if (bdrv_snapshot_load_tmp(bs[0], snapshot_name) < 0) { if (bdrv_snapshot_load_tmp(bs[0], snapshot_name) < 0) {
error_report("Failed to load snapshot\n"); error_report("Failed to load snapshot");
ret = -1; ret = -1;
goto out; goto out;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册