On Wed, Sep 02, 2015 at 09:39:11AM +0800, Yang Hongyang wrote: > On 09/01/2015 10:36 PM, Stefan Hajnoczi wrote: > >On Tue, Sep 01, 2015 at 05:06:14PM +0800, Yang Hongyang wrote: > >>diff --git a/qemu-options.hx b/qemu-options.hx > >>index 77f5853..f1d42a1 100644 > >>--- a/qemu-options.hx > >>+++ b/qemu-options.hx > >>@@ -1991,6 +1991,27 @@ override the default configuration (@option{-net nic > >>-net user}) which > >> is activated if no @option{-net} options are provided. > >> ETEXI > >> > >>+DEF("netfilter", HAS_ARG, QEMU_OPTION_netfilter, > >>+ "-netfilter buffer,id=str,netdev=str[,chain=in|out|all,interval=t]\n" > >>+ " buffer network packets on netdev. if interval > >>provided, will release\n" > >>+ " packets by interval. Interval scale: microsecond\n", > >>QEMU_ARCH_ALL) > > > >Perhaps the -object option should be used: > > > > -object netfilter-buffer,id=str,netdev=str[,chain=in|out|all,interval=t] > > > >That is how IOThread and memory backends were recently added. > > > >They are QOM objects (see include/qom/object.h) and eliminate the need > >to write boilerplate code that adds new command-line options and > >instantiates objects. > > I thought -netfilter is more obvious for an object name, -object is kind of > abstract name... but I'm not maintainer, if you think it's really need to > change to -object, I can do that.
The advantage of QOM and -object is that it eliminates code for command-line options, object instantiation, etc. They introduce a single object model that all types within QEMU can use instead of inventing their own. Personally I'm not that involved in QAPI or command-line but I thought -object was the new preferred way to do things. This is where I guess Markus and Andreas might have opinions. Stefan