All of lore.kernel.org
 help / color / mirror / Atom feed
* bpf: Change structure passing and assignment
@ 2018-01-13 12:42 Karim Eshapa
  2018-01-13 16:24 ` Alexei Starovoitov
  0 siblings, 1 reply; 2+ messages in thread
From: Karim Eshapa @ 2018-01-13 12:42 UTC (permalink / raw)
  To: ast; +Cc: daniel, netdev, linux-kernel

I noticed that most of functions here have structure arguements and return structure, all these structures passed and returned are delt in passing and assignment like memcpy a structure.In addition it takes size in stack while passing. so why not we use pointers to structure as argumentsor there is actual need to do such things and you intentionaly want to deal with copies of strucuteres.
ex:
struct tnum tnum_add(struct tnum a, struct tnum b)
{

}

Thanks,
Karim

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: bpf: Change structure passing and assignment
  2018-01-13 12:42 bpf: Change structure passing and assignment Karim Eshapa
@ 2018-01-13 16:24 ` Alexei Starovoitov
  0 siblings, 0 replies; 2+ messages in thread
From: Alexei Starovoitov @ 2018-01-13 16:24 UTC (permalink / raw)
  To: Karim Eshapa; +Cc: ast, daniel, netdev, linux-kernel

On Sat, Jan 13, 2018 at 02:42:19PM +0200, Karim Eshapa wrote:
> I noticed that most of functions here have structure arguements and return structure, all these structures passed and returned are delt in passing and assignment like memcpy a structure.In addition it takes size in stack while passing. so why not we use pointers to structure as argumentsor there is actual need to do such things and you intentionaly want to deal with copies of strucuteres.
> ex:
> struct tnum tnum_add(struct tnum a, struct tnum b)

and how an alternative for the above would look like with pointers ?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-13 16:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-13 12:42 bpf: Change structure passing and assignment Karim Eshapa
2018-01-13 16:24 ` Alexei Starovoitov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.