[Spice-devel] [PATCH v2 0/4] Command line parsing with Glib

Victor Toso victortoso at redhat.com
Tue May 16 17:27:51 UTC 2017


From: Victor Toso <me at victortoso.com>

-- v1->v2:
* 01/04
- Improve commit log to make the change clear (Christophe)
- Acked

* 02/04
- Make function type with function name in the same line
- Return const gchar* in xfer_get_download_directory; (Pavel)
- Explicit pointer comparison to NULL (Pavel)
- Renamed: vdagent_start_file_xfer() -> vdagent_init_file_xfer() (Pavel)

* 03/04
- Make function type with function name in the same line
- Renamed: vdagent_stop_file_xfer() -> vdagent_finalize_file_xfer()
- Removed new warning on VDAGENTD_CLIENT_DISCONNECTED on reinit of
  file_xfer() (Pavel)

* 04/04
- Keeping global variables to GOptionsEntry table as non const;
- All string pointers are set to NULL and freed in the end;
  (teuf/frediano)
- Moving the entries orders to be similiar as it was before; (teuf)
- diff is: http://paste.fedoraproject.org/paste/oXXLhHk-2nyb1h5SisutlV5M1UNdIGYhyRLivL9gydE=

-- v1:

Hi,

As we already link the vdagent code with glib, I think we should try to let it
do most of the work whenever is possible. The second and third patch are
preparatory patches to have GOption for command line parsing. The first patch is
an extra.

If this seems good/acceptable I'll go on and change the vdagentd too.

Besides the code changes, the interface changed

-- before --
$ spice-vdagent --help
spice-vdagent: invalid option -- '-'

Usage: spice-vdagent [OPTIONS]

Spice guest agent X11 session agent, version 0.16.0.

Options:
  -h                                print this text
  -d                                log debug messages
  -s <port>                         set virtio serial port
  -S <filename>                     set udcs socket
  -x                                don't daemonize
  -f <dir|xdg-desktop|xdg-download> file xfer save dir
  -o <0|1>                          open dir on file xfer completion

-- now --
$ spice-vdagent --help
Usage:
  spice-vdagent [OPTION...]

        Spice session guest agent: X11
        Version: 0.17.0

Help Options:
  -h, --help                        Show help options

Application Options:
  -d, --debug                       Enable debug
  -x, --foreground                  Do not daemonize the agent
  -y, --x11-abort-on-error          Aborts on errors from X11
  -o, --file-xfer-open-dir          Open directory after completing file transfer
  -s, --virtio-serial-port-path     Set virtio-serial path (/dev/virtio-ports/com.redhat.spice.0)
  -f, --file-xfer-save-dir          Set directory to file transfers files
  -S, --vdagentd-socket             Set spice-vdagentd socket (/var/run/spice-vdagentd/spice-vdagent-sock)

Cheers,
    toso

Victor Toso (4):
  vdagentd-proto: define default virtio-port path
  vdagent: move file xfer initialization to a function
  vdagent: move file xfer finalize to a function
  vdagent: Use glib's commandline parser

 src/vdagent/vdagent.c   | 215 ++++++++++++++++++++++++++++--------------------
 src/vdagentd-proto.h    |   2 +
 src/vdagentd/vdagentd.c |   2 +-
 3 files changed, 130 insertions(+), 89 deletions(-)

-- 
2.13.0



More information about the Spice-devel mailing list