* [patch 0/1][RFC] add a private field to the sock structure @ 2007-08-29 16:41 dlezcano 2007-08-29 16:41 ` [patch 1/1][RFC] " dlezcano 2007-08-29 18:23 ` [patch 0/1][RFC] " David Miller 0 siblings, 2 replies; 8+ messages in thread From: dlezcano @ 2007-08-29 16:41 UTC (permalink / raw) To: netdev When a socket is created it is sometime useful to store a specific information for this socket. This information can be for examples: * a creation time * a pid * a uid/gid * a container identifier * a pointer to a more specific structure * ... The following patch is a proposition to add a private anonymous pointer field to the common part of the sock structure. -- ^ permalink raw reply [flat|nested] 8+ messages in thread
* [patch 1/1][RFC] add a private field to the sock structure 2007-08-29 16:41 [patch 0/1][RFC] add a private field to the sock structure dlezcano @ 2007-08-29 16:41 ` dlezcano 2007-08-29 18:09 ` Christoph Hellwig 2007-08-29 18:23 ` [patch 0/1][RFC] " David Miller 1 sibling, 1 reply; 8+ messages in thread From: dlezcano @ 2007-08-29 16:41 UTC (permalink / raw) To: netdev [-- Attachment #1: sock-private-data.patch --] [-- Type: text/plain, Size: 2443 bytes --] From: Daniel Lezcano <dlezcano@fr.ibm.com> Store private information for a socket This patch adds a field to the common socket structure. This field is a anonymous pointer which allow to store an information about the socket Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com> --- include/net/inet_timewait_sock.h | 1 + include/net/sock.h | 3 +++ net/ipv4/inet_timewait_sock.c | 1 + 3 files changed, 5 insertions(+) Index: net-2.6.24-bf/include/net/sock.h =================================================================== --- net-2.6.24-bf.orig/include/net/sock.h +++ net-2.6.24-bf/include/net/sock.h @@ -106,6 +106,7 @@ * @skc_refcnt: reference count * @skc_hash: hash value used with various protocol lookup tables * @skc_prot: protocol handlers inside a network family + * @skc_private: field used to store private data * * This is the minimal network layer representation of sockets, the header * for struct sock and struct inet_timewait_sock. @@ -120,6 +121,7 @@ atomic_t skc_refcnt; unsigned int skc_hash; struct proto *skc_prot; + void *skc_private; }; /** @@ -196,6 +198,7 @@ #define sk_refcnt __sk_common.skc_refcnt #define sk_hash __sk_common.skc_hash #define sk_prot __sk_common.skc_prot +#define sk_private __sk_common.skc_private unsigned char sk_shutdown : 2, sk_no_check : 2, sk_userlocks : 4; Index: net-2.6.24-bf/net/ipv4/inet_timewait_sock.c =================================================================== --- net-2.6.24-bf.orig/net/ipv4/inet_timewait_sock.c +++ net-2.6.24-bf/net/ipv4/inet_timewait_sock.c @@ -108,6 +108,7 @@ tw->tw_hash = sk->sk_hash; tw->tw_ipv6only = 0; tw->tw_prot = sk->sk_prot_creator; + tw->tw_private = sk->sk_private; atomic_set(&tw->tw_refcnt, 1); inet_twsk_dead_node_init(tw); __module_get(tw->tw_prot->owner); Index: net-2.6.24-bf/include/net/inet_timewait_sock.h =================================================================== --- net-2.6.24-bf.orig/include/net/inet_timewait_sock.h +++ net-2.6.24-bf/include/net/inet_timewait_sock.h @@ -115,6 +115,7 @@ #define tw_refcnt __tw_common.skc_refcnt #define tw_hash __tw_common.skc_hash #define tw_prot __tw_common.skc_prot +#define tw_private __tw_common.skc_private volatile unsigned char tw_substate; /* 3 bits hole, try to pack */ unsigned char tw_rcv_wscale; -- ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch 1/1][RFC] add a private field to the sock structure 2007-08-29 16:41 ` [patch 1/1][RFC] " dlezcano @ 2007-08-29 18:09 ` Christoph Hellwig 0 siblings, 0 replies; 8+ messages in thread From: Christoph Hellwig @ 2007-08-29 18:09 UTC (permalink / raw) To: dlezcano; +Cc: netdev On Wed, Aug 29, 2007 at 06:41:15PM +0200, dlezcano@fr.ibm.com wrote: > From: Daniel Lezcano <dlezcano@fr.ibm.com> > > Store private information for a socket > > This patch adds a field to the common socket structure. This field > is a anonymous pointer which allow to store an information about > the socket If you have orivtae information it should have a typed pointer to it. Please also post the patches actually using this field. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch 0/1][RFC] add a private field to the sock structure 2007-08-29 16:41 [patch 0/1][RFC] add a private field to the sock structure dlezcano 2007-08-29 16:41 ` [patch 1/1][RFC] " dlezcano @ 2007-08-29 18:23 ` David Miller 2007-08-29 19:18 ` Arnaldo Carvalho de Melo 1 sibling, 1 reply; 8+ messages in thread From: David Miller @ 2007-08-29 18:23 UTC (permalink / raw) To: dlezcano; +Cc: netdev From: dlezcano@fr.ibm.com Date: Wed, 29 Aug 2007 18:41:14 +0200 > When a socket is created it is sometime useful to store a specific information > for this socket. > > This information can be for examples: > * a creation time > * a pid > * a uid/gid > * a container identifier > * a pointer to a more specific structure > * ... > > The following patch is a proposition to add a private anonymous pointer > field to the common part of the sock structure. We got rid of the private field a long time ago because not only is it not needed, it tends to get abused. Find another way to implement your feature. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch 0/1][RFC] add a private field to the sock structure 2007-08-29 18:23 ` [patch 0/1][RFC] " David Miller @ 2007-08-29 19:18 ` Arnaldo Carvalho de Melo 2007-08-29 21:15 ` Daniel Lezcano 2007-08-31 5:40 ` David Miller 0 siblings, 2 replies; 8+ messages in thread From: Arnaldo Carvalho de Melo @ 2007-08-29 19:18 UTC (permalink / raw) To: David Miller; +Cc: dlezcano, netdev, ralf Em Wed, Aug 29, 2007 at 11:23:16AM -0700, David Miller escreveu: > From: dlezcano@fr.ibm.com > Date: Wed, 29 Aug 2007 18:41:14 +0200 > > > When a socket is created it is sometime useful to store a specific information > > for this socket. > > > > This information can be for examples: > > * a creation time > > * a pid > > * a uid/gid > > * a container identifier > > * a pointer to a more specific structure > > * ... > > > > The following patch is a proposition to add a private anonymous pointer > > field to the common part of the sock structure. > > We got rid of the private field a long time ago because not only > is it not needed, it tends to get abused. Nah, it still there, sk_protinfo, its just ax25 that uses it (nudge(Ralf)). How do we state that a struct field is deprecated and will be removed soon(tm)? There is another, sk_user_data, that is used only by the rpc, pppol2tp, iscsi, ncpfs, smbfs and dlm guys, see? We need a deprecate flag for sk_protinfo, if not people will use it! :-) - Arnaldo ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch 0/1][RFC] add a private field to the sock structure 2007-08-29 19:18 ` Arnaldo Carvalho de Melo @ 2007-08-29 21:15 ` Daniel Lezcano 2007-08-31 5:40 ` David Miller 1 sibling, 0 replies; 8+ messages in thread From: Daniel Lezcano @ 2007-08-29 21:15 UTC (permalink / raw) To: Arnaldo Carvalho de Melo, David Miller, dlezcano, netdev, ralf, hch Arnaldo Carvalho de Melo wrote: > Em Wed, Aug 29, 2007 at 11:23:16AM -0700, David Miller escreveu: >> From: dlezcano@fr.ibm.com >> Date: Wed, 29 Aug 2007 18:41:14 +0200 >> >>> When a socket is created it is sometime useful to store a specific information >>> for this socket. >>> >>> This information can be for examples: >>> * a creation time >>> * a pid >>> * a uid/gid >>> * a container identifier >>> * a pointer to a more specific structure >>> * ... >>> >>> The following patch is a proposition to add a private anonymous pointer >>> field to the common part of the sock structure. >> We got rid of the private field a long time ago because not only >> is it not needed, it tends to get abused. > > Nah, it still there, sk_protinfo, its just ax25 that uses it > (nudge(Ralf)). How do we state that a struct field is deprecated and > will be removed soon(tm)? > > There is another, sk_user_data, that is used only by the rpc, pppol2tp, > iscsi, ncpfs, smbfs and dlm guys, see? We need a deprecate flag for > sk_protinfo, if not people will use it! :-) Thank you for your feedbacks. I will play with the sk_user_data. Is there a chance to have this field in the timewait sockets ? :) Regards --Daniel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch 0/1][RFC] add a private field to the sock structure 2007-08-29 19:18 ` Arnaldo Carvalho de Melo 2007-08-29 21:15 ` Daniel Lezcano @ 2007-08-31 5:40 ` David Miller 2007-08-31 11:26 ` Arnaldo Carvalho de Melo 1 sibling, 1 reply; 8+ messages in thread From: David Miller @ 2007-08-31 5:40 UTC (permalink / raw) To: acme; +Cc: dlezcano, netdev, ralf From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Date: Wed, 29 Aug 2007 16:18:31 -0300 > Nah, it still there, sk_protinfo, its just ax25 that uses it > (nudge(Ralf)). How do we state that a struct field is deprecated and > will be removed soon(tm)? You get rid of all the in-tree users and then just kill it :) More seriously, I don't think we need a deprecation schedule for a struct member, either it's not used in-tree anymore or it isn't. We'll go crazy with any other policy and it's difficult enough shrinking these things :-) ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [patch 0/1][RFC] add a private field to the sock structure 2007-08-31 5:40 ` David Miller @ 2007-08-31 11:26 ` Arnaldo Carvalho de Melo 0 siblings, 0 replies; 8+ messages in thread From: Arnaldo Carvalho de Melo @ 2007-08-31 11:26 UTC (permalink / raw) To: David Miller; +Cc: dlezcano, netdev, ralf Em Thu, Aug 30, 2007 at 10:40:49PM -0700, David Miller escreveu: > From: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> > Date: Wed, 29 Aug 2007 16:18:31 -0300 > > > Nah, it still there, sk_protinfo, its just ax25 that uses it > > (nudge(Ralf)). How do we state that a struct field is deprecated and > > will be removed soon(tm)? > > You get rid of all the in-tree users and then just kill it :) > > More seriously, I don't think we need a deprecation schedule > for a struct member, either it's not used in-tree anymore or > it isn't. We'll go crazy with any other policy and it's > difficult enough shrinking these things :-) OK, I think its enough to say to dlezcano that he should avoid using sk_protinfo, as soon as we do the work on AX.25 sk_protinfo will be removed. - Arnaldo ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-08-31 11:26 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-08-29 16:41 [patch 0/1][RFC] add a private field to the sock structure dlezcano 2007-08-29 16:41 ` [patch 1/1][RFC] " dlezcano 2007-08-29 18:09 ` Christoph Hellwig 2007-08-29 18:23 ` [patch 0/1][RFC] " David Miller 2007-08-29 19:18 ` Arnaldo Carvalho de Melo 2007-08-29 21:15 ` Daniel Lezcano 2007-08-31 5:40 ` David Miller 2007-08-31 11:26 ` Arnaldo Carvalho de Melo
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.