svn commit: r228071 - head/sys/net

Gleb Smirnoff glebius at FreeBSD.org
Tue Nov 29 13:55:09 UTC 2011


On Tue, Nov 29, 2011 at 09:43:37AM +0000, Bjoern A. Zeeb wrote:
B> On Tue, 29 Nov 2011, Gleb Smirnoff wrote:
B> > btw, I don't like the static initializer of cloners, since it require re-compile of
B> > dependencies.
B> >
B> > What about making an API change: remove the static initializer and make an initializer
B> > function. Modules should have only a pointer to opaque structure. We will bump
B> > __FreeBSD_version for that. But later with any change to the if_clone struct, we
B> > won't have ABI change. If everyone agrees, I can go for that.
B> 
B> I have some fairly intrusive changes to cloners sitting in p4 for the
B> V_irtualization but it could make my life easier;  I'll be happy to
B> look at the patch.

Okay, here is what I am suggesting:

- make struct if_clone opaque, and remove if from if_clone.h
- IF_CLONE_INITIALIZER and IFC_SIMPLE_DECLARE substituted with
  if_clone_advanced() and if_clone_simple()

Now, with all our guts obscure to the callers, we can simplify things:

- kill ifc_data, that was an old attempt to support simple & advanced cloners
  w/o changes to the struct ifclone
- make union that stores either simple or advanced methods and data
- kill ifc_attach, that was used only for simple callers, embed it into
  if_clone_simple()

Modifications to the callers are quite simple:

- substitute static initializer to 'static struct if_clone *fooclone;';
- substitite if_clone_attach() to either if_clone_advanced() or
  if_clone_simple()
- fix argument for if_clone_detach()
- if module reads ifc_name, substitute it to some locally stored name

Attached patch includes the core changes, changes to lo(4) - a simple
cloner, vlan(4) - advanced one, and epair(4) - API abuser :) All three
work, so I think converting others won't be a problem.

I am only not 100% sure that I've put correct code under VIMAGE ifdefs.
Can you review this part thoroughly?

If you agree with suggested changes, I can proceed to converting other
callers and commit.

-- 
Totus tuus, Glebius.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: if_clone.diff
Type: text/x-diff
Size: 19198 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20111129/32150211/if_clone.bin


More information about the svn-src-all mailing list