misc: mic: Fix build issues in sample daemon.
Specifying gcc format function attribute for mpsslog(..) and building on 32 bit systems exposed a few build issues in the sample MIC daemon which are fixed by this patch. Some of these changes were authored by Joe Perches @ https://lkml.org/lkml/2013/9/27/419 Reported-by: Joe Perches <joe@perches.com> Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com> Signed-off-by: Caz Yokoyama <Caz.Yokoyama@intel.com> Signed-off-by: Sudeep Dutt <sudeep.dutt@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
af68fb6555
commit
6078e0bef2
@ -362,9 +362,9 @@ static inline void verify_out_len(struct mic_info *mic,
|
|||||||
struct mic_copy_desc *copy)
|
struct mic_copy_desc *copy)
|
||||||
{
|
{
|
||||||
if (copy->out_len != sum_iovec_len(copy)) {
|
if (copy->out_len != sum_iovec_len(copy)) {
|
||||||
mpsslog("%s %s %d BUG copy->out_len 0x%x len 0x%x\n",
|
mpsslog("%s %s %d BUG copy->out_len 0x%x len 0x%zx\n",
|
||||||
mic->name, __func__, __LINE__,
|
mic->name, __func__, __LINE__,
|
||||||
copy->out_len, sum_iovec_len(copy));
|
copy->out_len, sum_iovec_len(copy));
|
||||||
assert(copy->out_len == sum_iovec_len(copy));
|
assert(copy->out_len == sum_iovec_len(copy));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -377,7 +377,7 @@ disp_iovec(struct mic_info *mic, struct mic_copy_desc *copy,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < copy->iovcnt; i++)
|
for (i = 0; i < copy->iovcnt; i++)
|
||||||
mpsslog("%s %s %d copy->iov[%d] addr %p len 0x%lx\n",
|
mpsslog("%s %s %d copy->iov[%d] addr %p len 0x%zx\n",
|
||||||
mic->name, s, line, i,
|
mic->name, s, line, i,
|
||||||
copy->iov[i].iov_base, copy->iov[i].iov_len);
|
copy->iov[i].iov_base, copy->iov[i].iov_len);
|
||||||
}
|
}
|
||||||
@ -630,7 +630,7 @@ virtio_net(void *arg)
|
|||||||
disp_iovec(mic, ©, __func__, __LINE__);
|
disp_iovec(mic, ©, __func__, __LINE__);
|
||||||
mpsslog("%s %s %d read failed %s ", mic->name,
|
mpsslog("%s %s %d read failed %s ", mic->name,
|
||||||
__func__, __LINE__, strerror(errno));
|
__func__, __LINE__, strerror(errno));
|
||||||
mpsslog("cnt %d sum %d\n",
|
mpsslog("cnt %d sum %zd\n",
|
||||||
copy.iovcnt, sum_iovec_len(©));
|
copy.iovcnt, sum_iovec_len(©));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -680,8 +680,8 @@ virtio_net(void *arg)
|
|||||||
if (len != sum_iovec_len(©)) {
|
if (len != sum_iovec_len(©)) {
|
||||||
mpsslog("Tun write failed %s ",
|
mpsslog("Tun write failed %s ",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
mpsslog("len 0x%x ", len);
|
mpsslog("len 0x%zx ", len);
|
||||||
mpsslog("read_len 0x%x\n",
|
mpsslog("read_len 0x%zx\n",
|
||||||
sum_iovec_len(©));
|
sum_iovec_len(©));
|
||||||
} else {
|
} else {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -827,7 +827,7 @@ virtio_console(void *arg)
|
|||||||
mpsslog("%s %s %d read failed %s ",
|
mpsslog("%s %s %d read failed %s ",
|
||||||
mic->name, __func__, __LINE__,
|
mic->name, __func__, __LINE__,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
mpsslog("cnt %d sum %d\n",
|
mpsslog("cnt %d sum %zd\n",
|
||||||
copy.iovcnt, sum_iovec_len(©));
|
copy.iovcnt, sum_iovec_len(©));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -859,8 +859,8 @@ virtio_console(void *arg)
|
|||||||
if (len != sum_iovec_len(©)) {
|
if (len != sum_iovec_len(©)) {
|
||||||
mpsslog("Tun write failed %s ",
|
mpsslog("Tun write failed %s ",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
mpsslog("len 0x%x ", len);
|
mpsslog("len 0x%zx ", len);
|
||||||
mpsslog("read_len 0x%x\n",
|
mpsslog("read_len 0x%zx\n",
|
||||||
sum_iovec_len(©));
|
sum_iovec_len(©));
|
||||||
} else {
|
} else {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -953,7 +953,7 @@ set_backend_file(struct mic_info *mic)
|
|||||||
return false;
|
return false;
|
||||||
mic->mic_virtblk.backend_file = malloc(strlen(evv) + 1);
|
mic->mic_virtblk.backend_file = malloc(strlen(evv) + 1);
|
||||||
if (mic->mic_virtblk.backend_file == NULL) {
|
if (mic->mic_virtblk.backend_file == NULL) {
|
||||||
mpsslog("can't allocate memory\n", mic->name, mic->id);
|
mpsslog("%s %d can't allocate memory\n", mic->name, mic->id);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
strcpy(mic->mic_virtblk.backend_file, evv + 1);
|
strcpy(mic->mic_virtblk.backend_file, evv + 1);
|
||||||
@ -1026,7 +1026,7 @@ close_backend(struct mic_info *mic)
|
|||||||
static bool
|
static bool
|
||||||
start_virtblk(struct mic_info *mic, struct mic_vring *vring)
|
start_virtblk(struct mic_info *mic, struct mic_vring *vring)
|
||||||
{
|
{
|
||||||
if (((__u64)&virtblk_dev_page.blk_config % 8) != 0) {
|
if (((unsigned long)&virtblk_dev_page.blk_config % 8) != 0) {
|
||||||
mpsslog("%s: blk_config is not 8 byte aligned.\n",
|
mpsslog("%s: blk_config is not 8 byte aligned.\n",
|
||||||
mic->name);
|
mic->name);
|
||||||
return false;
|
return false;
|
||||||
|
@ -94,6 +94,7 @@ struct mic_info {
|
|||||||
struct mic_info *next;
|
struct mic_info *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
__attribute__((format(printf, 1, 2)))
|
||||||
void mpsslog(char *format, ...);
|
void mpsslog(char *format, ...);
|
||||||
char *readsysfs(char *dir, char *entry);
|
char *readsysfs(char *dir, char *entry);
|
||||||
int setsysfs(char *dir, char *entry, char *value);
|
int setsysfs(char *dir, char *entry, char *value);
|
||||||
|
Loading…
Reference in New Issue
Block a user