[libvirt] [PATCH 2/3] conf: Clean up nodedev code

Peter Krempa pkrempa at redhat.com
Thu Mar 2 11:10:41 UTC 2017


On Thu, Mar 02, 2017 at 10:47:20 +0100, Michal Privoznik wrote:
> On 03/02/2017 10:16 AM, Peter Krempa wrote:
> > On Thu, Mar 02, 2017 at 10:04:24 +0100, Michal Privoznik wrote:
> >> On 03/02/2017 09:58 AM, Peter Krempa wrote:
> >>> On Wed, Mar 01, 2017 at 19:27:15 -0500, John Ferlan wrote:
> >>>> Alter the static functions from virNodeDev* to just nodeDev* as a visual
> >>>> cue to determine which are local or not when reading code.
> >>>>
> >>>> Cleanup spacing between functions, function defs, etc. to match more modern
> >>>> techniques used in libvirt
> >>>>
> >>>> Signed-off-by: John Ferlan <jferlan at redhat.com>
> >>>> ---
> >>>>  src/conf/node_device_conf.c | 476 +++++++++++++++++++++++---------------------
> >>>>  src/conf/virnodedeviceobj.c | 128 ++++++------
> >>>>  2 files changed, 322 insertions(+), 282 deletions(-)

[...]

> > The static function name may still show up in logs and backtraces. It's
> > better to see what belongs to libvirt and what does not.
> 
> I don't know about your backtraces, but mine show the filename too.
> Either actual source file or .so file where the symbol comes from. We
> can rely on that.
> Or if a static function of ours calls a function from another library,
> it's going to be visible too:
> 
> #0 virExposedAPI
> #1 someStaticFunc
> #2 someOtherStaticFunc
> #3 glfs_creat
> #4 yetAnotherStaticFunc

Let's try some real example where our namespace collides with others:

#0  0x00007fdaa6651770 in udev_device_get_devtype () from /lib64/libudev.so.1
#1  0x00007fda989e9ea6 in udevGetDeviceType (type=0x55c03b7df050, device=0x55c03b7ae650) at node_device/node_device_udev.c:992
#2  udevAddOneDevice (device=device at entry=0x55c03b7ae650) at node_device/node_device_udev.c:1194
#3  0x00007fda989ebb9a in udevEventHandleCallback (watch=watch at entry=8, fd=<optimized out>, events=events at entry=1, 
    data=data at entry=0x0) at node_device/node_device_udev.c:1405

Yes you can see it by looking at 'from' or due to the fact that libudev
uses undescores rather than camel case, but on first glance the
difference is impossible to spot.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170302/c0e069ad/attachment-0001.sig>


More information about the libvir-list mailing list