lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Sat, 20 Sep 2014 14:37:02 -0700 From: Joe Perches <joe@...ches.com> To: Richard Cochran <richardcochran@...il.com> Cc: Alexander Duyck <alexander.h.duyck@...el.com>, davem@...emloft.net, nhorman@...hat.com, netdev@...r.kernel.org, john.fastabend@...il.com, matthew.vick@...el.com, jeffrey.t.kirsher@...el.com, sassmann@...hat.com Subject: Re: [net-next PATCH 29/29] fm10k: Add support for PTP On Sat, 2014-09-20 at 23:07 +0200, Richard Cochran wrote: > On Fri, Sep 19, 2014 at 11:32:24AM -0700, Alexander Duyck wrote: > > Because doing it that way it extends over 80 characters. > > Obviously, but still the result is really ugly. True. It might be reasonable to add a new container_of_ptr to kernel.h Something like: /** * container_of_ptr - cast a member of a pointer to a structure * out to the containing structure * @ptr: the pointer to the member. * @type_ptr: a pointer of type of the container struct this is embedded in. * @member: the name of the member within the type_ptr. * */ #define container_of_ptr(ptr, type_ptr, member) \ ({ \ const typeof((type_ptr)->member) *__mptr = (ptr); \ (type_ptr)((char *)__mptr - \ ((char *)&((ptr_type)->member) - (char *)(ptr_type))); \ }) So this could be written as: struct fm10k_intfc *interface = container_of_ptr(hw, interface, hw); -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists