qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: ronnie sahlberg <ronniesahlberg@gmail.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 01/14] ./block/iscsi/init.c
Date: Sat, 4 Dec 2010 08:23:27 +1100	[thread overview]
Message-ID: <AANLkTi=c5dVVmnK6y7BUsg6oMM6X3OP+10s0qb-T2OMi@mail.gmail.com> (raw)
In-Reply-To: <AANLkTinw95RxZGntr3ccSfWKfjUaKmFTGyLNvHB-HVLS@mail.gmail.com>

Thankyou.

On Sat, Dec 4, 2010 at 7:32 AM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
>
> You want the library to be GPL, not LGPL?

I have changed it to LGPLv3 for next submission.

>> +       /* use a "random" isid */
>> +       srandom(getpid() ^ time(NULL));
>
> The random number generator has global state and the library may
> interfere if the program also uses the srandom() interface.
...
> Is there an interface to set a specific isid value?  Users will
> probably want to use a permanent value.

I have removed the call to srandom() and instead initialize it to a
'random' ISID
where the B+C fields are initialized to getpid()^time(NULL).

I also added a public function iscsi_set_isid_random(iscsi, value)
where a user can set
the value explicitly.

>> +       if (iscsi->alias != NULL) {
>> +               free(discard_const(iscsi->alias));
>> +               iscsi->alias = NULL;
>> +       }
>
> All these if statements are unnecessary.  free(NULL) is a nop.

I have removed these if-statement from here, as well as for all other
files where similar constructs were used.

>
>> +       if (iscsi->fd != -1) {
>> +               iscsi_disconnect(iscsi);
>
> Perhaps disconnect before freeing struct members?

Yes. Done.

>> +       while ((pdu = iscsi->outqueue)) {
>> +               SLIST_REMOVE(&iscsi->outqueue, pdu);
>> +               pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL,
>> +                             pdu->private_data);
>> +               iscsi_free_pdu(iscsi, pdu);
>> +       }
>> +       while ((pdu = iscsi->waitpdu)) {
>> +               SLIST_REMOVE(&iscsi->waitpdu, pdu);
>> +               pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL,
>> +                             pdu->private_data);
>> +               iscsi_free_pdu(iscsi, pdu);
>> +       }
>
> Could these callbacks expect iscsi to still be valid?  A safer order
> would seem to be: disconnect, cancel all, free.

Yes. Done.


> +iscsi_set_error(struct iscsi_context *iscsi, const char *error_string, ...)
>> +{
>> +       va_list ap;
>> +       char *str;
>> +
>> +       va_start(ap, error_string);
>> +       if (vasprintf(&str, error_string, ap) < 0) {
>
> This function is available in GNU and BSD.  Not sure what level of
> portability you are targeting (e.g. what about Windows)?

Posix for now. Win32 later, if/when someone needs it.
The makefile corrently only builds this support for posix systems.

>
>> +               /* not much we can do here */
>
> You need to assign str = NULL here.  Otherwise its value is undefined
> on GNU systems.

Good catch. Done.

>
>> +       }
>> +       if (iscsi->error_string != NULL) {
>> +               free(iscsi->error_string);
>> +       }
>> +       iscsi->error_string = str;
>> +       va_end(ap);
>> +}
>> +
>> +
>> +char *
>
> const char *?

Done.

> Stefan
>


Thanks
Ronnie Sahlberg

  reply	other threads:[~2010-12-03 21:23 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-03 11:09 [Qemu-devel] [Patch 0/14] builtin iscsi support ronniesahlberg
2010-12-03 11:09 ` [Qemu-devel] [PATCH 01/14] ./block/iscsi/init.c ronniesahlberg
2010-12-03 20:32   ` Stefan Hajnoczi
2010-12-03 21:23     ` ronnie sahlberg [this message]
2010-12-06 16:09       ` Kevin Wolf
2010-12-03 11:09 ` [Qemu-devel] [PATCH 02/14] ./block/iscsi/socket.c ronniesahlberg
2010-12-04 13:06   ` Stefan Hajnoczi
2010-12-03 11:09 ` [Qemu-devel] [PATCH 03/14] ./block/iscsi/login.c ronniesahlberg
2010-12-03 11:09 ` [Qemu-devel] [PATCH 04/14] ./block/iscsi/discovery.c ronniesahlberg
2010-12-03 11:09 ` [Qemu-devel] [PATCH 05/14] ./block/iscsi/crc32c.c ronniesahlberg
2010-12-03 11:09 ` [Qemu-devel] [PATCH 06/14] ./block/iscsi/nop.c ronniesahlberg
2010-12-03 11:09 ` [Qemu-devel] [PATCH 07/14] ./block/iscsi/pdu.c ronniesahlberg
2010-12-03 11:09 ` [Qemu-devel] [PATCH 08/14] ./block/iscsi/sscsi-command.c ronniesahlberg
2010-12-03 11:09 ` [Qemu-devel] [PATCH 09/14] ./block/iscsi/scsi-lowlevel.c ronniesahlberg
2010-12-03 11:09 ` [Qemu-devel] [PATCH 10/14] ./block/iscsi/sync.c ronniesahlberg
2010-12-03 11:09 ` [Qemu-devel] [PATCH 11/14] ./block/iscsi/connect.c ronniesahlberg
2010-12-03 11:09 ` [Qemu-devel] [PATCH 12/14] ./block/iscsi/*.h ronniesahlberg
2010-12-03 11:09 ` [Qemu-devel] [PATCH 13/14] ./block/iscsi.c ronniesahlberg
2010-12-03 11:09 ` [Qemu-devel] [PATCH 14/14] iscsi support ronniesahlberg
2010-12-03 11:42 ` [Qemu-devel] [Patch 0/14] builtin " Stefan Hajnoczi
2010-12-03 11:50   ` ronnie sahlberg
2010-12-03 15:05 ` Anthony Liguori
2010-12-03 19:57   ` ronnie sahlberg
2010-12-03 21:22     ` Anthony Liguori

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='AANLkTi=c5dVVmnK6y7BUsg6oMM6X3OP+10s0qb-T2OMi@mail.gmail.com' \
    --to=ronniesahlberg@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@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).