qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v7 06/42] Add wrapper for setting blocking statu


From: Juan Quintela
Subject: Re: [Qemu-devel] [PATCH v7 06/42] Add wrapper for setting blocking status on a QEMUFile
Date: Wed, 17 Jun 2015 14:57:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

"Dr. David Alan Gilbert" <address@hidden> wrote:
> * Juan Quintela (address@hidden) wrote:
>> "Dr. David Alan Gilbert (git)" <address@hidden> wrote:
>> > From: "Dr. David Alan Gilbert" <address@hidden>
>> >
>> > Add a wrapper to change the blocking status on a QEMUFile
>> > rather than having to use qemu_set_block(qemu_get_fd(f));
>> > it seems best to avoid exposing the fd since not all QEMUFile's
>> > really have one.  With this wrapper we could move the implementation
>> > down to be different on different transports.
>> >
>> > Signed-off-by: Dr. David Alan Gilbert <address@hidden>
>> > Reviewed-by: Amit Shah <address@hidden>
>> 
>> Reviewed-by: Juan Quintela <address@hidden>
>> 
>> Can we improve naming?
>> 
>> > ---
>> >  include/migration/qemu-file.h |  1 +
>> >  migration/qemu-file.c         | 15 +++++++++++++++
>> >  2 files changed, 16 insertions(+)
>> >
>> > diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h
>> > index 29a9d69..d43c835 100644
>> > --- a/include/migration/qemu-file.h
>> > +++ b/include/migration/qemu-file.h
>> > @@ -193,6 +193,7 @@ int qemu_file_get_error(QEMUFile *f);
>> >  void qemu_file_set_error(QEMUFile *f, int ret);
>> >  int qemu_file_shutdown(QEMUFile *f);
>> >  void qemu_fflush(QEMUFile *f);
>> > +void qemu_file_change_blocking(QEMUFile *f, bool block);
>> >  
>> >  static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv)
>> >  {
>> > diff --git a/migration/qemu-file.c b/migration/qemu-file.c
>> > index c111a6b..c746129 100644
>> > --- a/migration/qemu-file.c
>> > +++ b/migration/qemu-file.c
>> > @@ -651,3 +651,18 @@ size_t qemu_get_counted_string(QEMUFile *f, char 
>> > buf[256])
>> >  
>> >      return res == len ? res : 0;
>> >  }
>> > +
>> > +/*
>> > + * Change the blocking state of the QEMUFile.
>> > + * Note: On some transports the OS only keeps a single blocking state for
>> > + *       both directions, and thus changing the blocking on the main
>> > + *       QEMUFile can also affect the return path.
>> > + */
>> > +void qemu_file_change_blocking(QEMUFile *f, bool block)
>> 
>> qemu_file_set_blocking?
>> 
>> It don't change the blocking, it just do whatever block says?
>> 
>> > +{
>> > +    if (block) {
>> > +        qemu_set_block(qemu_get_fd(f));
>> > +    } else {
>> > +        qemu_set_nonblock(qemu_get_fd(f));
>> > +    }
>> > +}
>
> I worry about having a:
>    qemu_file_set_blocking
> and a 
>    qemu_set_block
>
> it sounds a bit similar when one always 'sets' (i.e. turns on)
> and the other either turns on or off.

There is a parameter difference, but I am not writting the code, and
don't care so much.  I would expect a function with change in its name
to change to the other plocking, whatever that is :P

Later, Juan.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]