From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ilias Apalodimas Subject: Re: [PATCH iproute2 net-next v2 2/6] include: Add helper to retrieve a __s64 from a netlink msg Date: Fri, 5 Oct 2018 11:41:07 +0300 Message-ID: <20181005084107.GA16936@apalos> References: <20181004231711.6058-1-vinicius.gomes@intel.com> <20181004231711.6058-3-vinicius.gomes@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org, jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, jesus.sanchez-palencia@intel.com, simon.fok@baesystems.com To: Vinicius Costa Gomes Return-path: Received: from mail-wm1-f65.google.com ([209.85.128.65]:51694 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728072AbeJEPiy (ORCPT ); Fri, 5 Oct 2018 11:38:54 -0400 Received: by mail-wm1-f65.google.com with SMTP id 143-v6so1064408wmf.1 for ; Fri, 05 Oct 2018 01:41:11 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20181004231711.6058-3-vinicius.gomes@intel.com> Sender: netdev-owner@vger.kernel.org List-ID: On Thu, Oct 04, 2018 at 04:17:07PM -0700, Vinicius Costa Gomes wrote: > This allows signed 64-bit integers to be retrieved from a netlink > message. > --- > include/libnetlink.h | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/include/libnetlink.h b/include/libnetlink.h > index 9d9249e6..88164975 100644 > --- a/include/libnetlink.h > +++ b/include/libnetlink.h > @@ -185,6 +185,13 @@ static inline __u64 rta_getattr_u64(const struct rtattr *rta) > memcpy(&tmp, RTA_DATA(rta), sizeof(__u64)); > return tmp; > } > +static inline __s64 rta_getattr_s64(const struct rtattr *rta) > +{ > + __s64 tmp; > + > + memcpy(&tmp, RTA_DATA(rta), sizeof(__s64)); Maybe change it to sizeof(tmp)? > + return tmp; > +} > static inline const char *rta_getattr_str(const struct rtattr *rta) > { > return (const char *)RTA_DATA(rta); > -- > 2.19.0 >