Re: [PATCH v15 15/18] trace-cmd: Refactor few trace-cmd internal functions.

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

 



On Thu, Nov 28, 2019 at 11:01 AM Tzvetomir Stoyanov (VMware)
<tz.stoyanov@xxxxxxxxx> wrote:
>
> In order to reuse code inside trace-cmd application context,
> few functions are made non static:
>         int make_vsock(unsigned int port);
>         int get_vsock_port(int sd, unsigned int *port);
>         int open_vsock(unsigned int cid, unsigned int port);
>         char *get_guest_file(const char *file, const char *guest);
>
> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@xxxxxxxxx>
> ---
>  tracecmd/include/trace-local.h | 8 ++++++++
>  tracecmd/trace-agent.c         | 4 ++--
>  tracecmd/trace-record.c        | 8 ++++----
>  3 files changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/tracecmd/include/trace-local.h b/tracecmd/include/trace-local.h
> index a6f79c5..17ef31a 100644
> --- a/tracecmd/include/trace-local.h
> +++ b/tracecmd/include/trace-local.h
> @@ -19,6 +19,8 @@
>  #define GUEST_FIFO_FMT         GUEST_DIR_FMT "/" GUEST_PIPE_NAME "%d"
>  #define VIRTIO_FIFO_FMT                "/dev/virtio-ports/" GUEST_PIPE_NAME "%d"
>
> +#define TRACE_FILENAME         "trace.dat"
> +
>  /* fix stupid glib guint64 typecasts and printf formats */
>  typedef unsigned long long u64;
>
> @@ -258,6 +260,12 @@ void tracecmd_disable_tracing(void);
>  void tracecmd_enable_tracing(void);
>  void tracecmd_stat_cpu(struct trace_seq *s, int cpu);
>
> +int make_vsock(unsigned int port);
> +int get_vsock_port(int sd, unsigned int *port);

trace-agent.c is not getting compiled if VSOCK isn't defined so those
functions won't be available then. Put them undef #ifdef VSOCK here
too? Or have all vsock functions in a separate .c file, #ifdef-ed so
that those functions do nothing when VSOCK is not defined?

> +int open_vsock(unsigned int cid, unsigned int port);
> +
> +char *get_guest_file(const char *file, const char *guest);

Cheers,

-- Slavi



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux