[libvirt] [PATCH 9/9] Move virRun, virExec*, virFork to util/command

Eric Blake eblake at redhat.com
Fri May 13 22:34:45 UTC 2011


On 05/13/2011 02:10 PM, Cole Robinson wrote:
> Seems reasonable to have all command wrappers in the same place
> 
> v2:
>     Dont move SetInherit
> 
> Signed-off-by: Cole Robinson <crobinso at redhat.com>
> ---
>  cfg.mk                                    |    2 +-
>  src/libvirt_private.syms                  |    5 +-
>  src/lxc/veth.c                            |    2 +-
>  src/nwfilter/nwfilter_ebiptables_driver.c |    1 +
>  src/storage/storage_backend_fs.c          |    2 +-
>  src/storage/storage_backend_logical.c     |    2 +-
>  src/util/command.c                        |  568 +++++++++++++++++++++++++++++
>  src/util/command.h                        |   14 +
>  src/util/ebtables.c                       |    2 +-
>  src/util/pci.c                            |    2 +-
>  src/util/util.c                           |  568 +----------------------------
>  src/util/util.h                           |   24 --
>  src/vmware/vmware_driver.c                |    1 +
>  13 files changed, 602 insertions(+), 591 deletions(-)
> 
> @@ -914,7 +916,6 @@ virEnumFromString;
>  virEnumToString;
>  virEventAddHandle;
>  virEventRemoveHandle;
> -virExecWithHook;

Did we miss this hunk in an earlier patch?  Oh well, at least we're
fixing it here.

> +++ b/src/util/command.c
> @@ -26,6 +26,12 @@
>  #include <stdlib.h>
>  #include <sys/stat.h>
>  #include <sys/wait.h>
> +#include <sys/types.h>

You can probably drop the <sys/types.h> line.  POSIX (and gnulib)
guarantee that most other headers are self-contained.

> +/* Flags for virExecWithHook */
> +enum {
> +    VIR_EXEC_NONE   = 0,
> +    VIR_EXEC_NONBLOCK = (1 << 0),
> +    VIR_EXEC_DAEMON = (1 << 1),
> +    VIR_EXEC_CLEAR_CAPS = (1 << 2),
> +};
> +
>  enum {
>      /* Internal-use extension beyond public VIR_EXEC_ flags */
>      VIR_EXEC_RUN_SYNC = 0x40000000,

Oops, you missed my review comment from v1 that these two enums should
be merged into one, now that _all_ flags are internal use only.

> +# else
> +static int virClearCapabilities(void)
> +{
> +//    VIR_WARN0("libcap-ng support not compiled in, unable to clear capabilities");

s/VIR_WARN0/VIR_WARN/ so that if we ever uncomment this, it will compile.

> +    if (forkRet < 0) {
> +        /* The fork was sucessful, but after that there was an error

s/sucessful/successful/

> +++ b/src/util/util.c
> @@ -34,11 +34,11 @@
>  #include <errno.h>
>  #include <poll.h>
>  #include <time.h>
> -#include <sys/types.h>
> -#include <sys/stat.h>
>  #include <sys/ioctl.h>
>  #include <sys/wait.h>
>  #include <sys/time.h>
> +#include <sys/stat.h>
> +#include <sys/types.h>

Looks like a spurious hunk.  Were you trying to sort lines?  You can
probably drop <sys/types.h>.

ACK with those nits addressed.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110513/0c4fe503/attachment-0001.sig>


More information about the libvir-list mailing list