From: Paolo Bonzini <pbonzini@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@gmail.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Peter Lieven <pl@kamp.de>,
"open list:iSCSI" <qemu-block@nongnu.org>,
Ronnie Sahlberg <ronniesahlberg@gmail.com>,
Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2] iscsi: use scsi_create_task()
Date: Tue, 1 Aug 2017 15:03:26 +0200 [thread overview]
Message-ID: <3aea4cac-8991-c289-a476-6ad0434cedcd@redhat.com> (raw)
In-Reply-To: <CAJ+F1CJrki3DvYX_oOR++n_r8_Uai9OB+LiNyDnBtiU5qebtbA@mail.gmail.com>
On 28/07/2017 19:52, Marc-André Lureau wrote:
>
> Stupid question: what's the benefit?
>
> scsi_create/scsi_free is a library API. If they have their own
> allocator, we better use it, or it may easily break, no?
Well, that would be an API breakage, but I see the point. I think I
would prefer something like
static inline struct scsi_task *iscsi_create_task(...)
{
#if ...
return scsi_create_task(...)
#else
/* Older versions of libiscsi have a bug, so include our
* implementation.
*/
struct scsi_task *task = g_try_malloc0(sizeof(struct scsi_task));
if (!task) {
task;
}
memcpy(&task->cdb[0], cdb, cdb_size);
task->cdb_size = cdb_size;
task->xfer_dir = xfer_dir;
task->expxferlen = expxferlen;
return task;
#endif
}
>
> Change malloc to g_new0 in the
> existing code, and we even make it shorter...
>
>
> replacing malloc with g_new is the subject of another upcoming series :)
> (https://github.com/elmarco/clang-tools-extra/blob/master/clang-tidy/qemu/UseGnewCheck.cpp)
>
prev parent reply other threads:[~2017-08-01 13:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-28 16:30 [Qemu-devel] [PATCH v2] iscsi: use scsi_create_task() Marc-André Lureau
2017-07-28 16:58 ` Paolo Bonzini
2017-07-28 17:52 ` Marc-André Lureau
2017-08-01 13:03 ` Paolo Bonzini [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3aea4cac-8991-c289-a476-6ad0434cedcd@redhat.com \
--to=pbonzini@redhat.com \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@gmail.com \
--cc=mreitz@redhat.com \
--cc=pl@kamp.de \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=ronniesahlberg@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).