On Wed, Jan 03, 2018 at 06:33:46PM +0530, Harsha Sharma wrote:
> * netlink.c: decode family NETLINK_KOBJECT_UEVENT if prefix is libudev
> * linux/netlink_kobject_uevent.h: New struct (udev_monitor_netlink_header)
> 
> Signed-off-by: Harsha Sharma <harshasharmai...@gmail.com>
> ---
>  linux/netlink_kobject_uevent.h | 16 ++++++++++++++++
>  netlink.c                      | 27 ++++++++++++++++++++++++++-
>  2 files changed, 42 insertions(+), 1 deletion(-)
>  create mode 100644 linux/netlink_kobject_uevent.h
> 
> diff --git a/linux/netlink_kobject_uevent.h b/linux/netlink_kobject_uevent.h
> new file mode 100644
> index 00000000..d83ccad5
> --- /dev/null
> +++ b/linux/netlink_kobject_uevent.h
> @@ -0,0 +1,16 @@
> +#ifndef STRACE_LINUX_NETLINK_KOBJECT_UEVENT_H
> +#define STRACE_LINUX_NETLINK_KOBJECT_UEVENT_H
> +
> +struct udev_monitor_netlink_header {
> +     char prefix[8];
> +     unsigned int magic;
> +     unsigned int header_size;
> +     unsigned int properties_off;
> +     unsigned int properties_len;
> +     unsigned int filter_subsystem_hash;
> +     unsigned int filter_devtype_hash;
> +     unsigned int filter_tag_bloom_hi;
> +     unsigned int filter_tag_bloom_lo;
> +};
> +
> +#endif /* !STRACE_LINUX_NETLINK_KOBJECT_UEVENT_H */
> diff --git a/netlink.c b/netlink.c
> index 6b9a1f5c..e991ed86 100644
> --- a/netlink.c
> +++ b/netlink.c
> @@ -32,6 +32,7 @@
>  #include "nlattr.h"
>  #include <linux/audit.h>
>  #include <linux/rtnetlink.h>
> +#include <linux/netlink_kobject_uevent.h>
>  #include <linux/xfrm.h>
>  #include "xlat/netlink_ack_flags.h"
>  #include "xlat/netlink_delete_flags.h"
> @@ -183,6 +184,29 @@ decode_nlmsg_type_netfilter(const struct xlat *const 
> xlat,
>               tprintf("%#x", msg_type);
>  }
>  
> +static bool
> +decode_nlmsg_type_kobject_uevent(struct tcb *tcp, kernel_ulong_t addr,
> +                              kernel_ulong_t len,
> +                              const void *const opaque_data)
> +{
> +     struct udev_monitor_netlink_header uh;
> +     const char *prefix = "libudev";
> +
> +     if (len < sizeof(uh))
> +             return false;
> +     if (!umove_or_printaddr(tcp, addr, &uh) &&
> +         strcmp(uh.prefix, prefix) == 0) {
> +             tprintf("{prefix=%s, magic=%u, header_size=%u, 
> properties_off=%u, properties_len=%u, filter_subsystem_hash=%u, 
> filter_devtype_hash=%u, filter_tag_bloom_hi=%u, filter_tag_bloom_lo=%u}", 
> uh.prefix,
> +                 uh.magic, uh.header_size, uh.properties_off,
> +                 uh.properties_len, uh.filter_subsystem_hash,
> +                 uh.filter_devtype_hash, uh.filter_tag_bloom_hi,
> +                 uh.filter_tag_bloom_lo);

Could you rewrite this tprintf using PRINT_FIELD_U and PRINT_FIELD_CSTRING
primitives defined in print_fields.h, please?


-- 
ldv

Attachment: signature.asc
Description: PGP signature

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to