Re: [PATCH 1/3] conf: Introduce virnodedeviceobj

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 01, 2017 at 07:27:14PM -0500, John Ferlan wrote:
> Move all the NodeDeviceObj API's into their own module virnodedeviceobj
> from the node_device_conf
> 
> Purely code motion at this point, plus adjustments to cleanly build.
> 
> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
> ---
>  po/POTFILES.in                       |   1 +
>  src/Makefile.am                      |   3 +-
>  src/conf/node_device_conf.c          | 505 --------------------------------
>  src/conf/node_device_conf.h          |  50 ----
>  src/conf/virnodedeviceobj.c          | 542 +++++++++++++++++++++++++++++++++++
>  src/conf/virnodedeviceobj.h          |  78 +++++
>  src/libvirt_private.syms             |  23 +-
>  src/node_device/node_device_driver.h |   2 +-
>  src/test/test_driver.c               |   1 +
>  9 files changed, 638 insertions(+), 567 deletions(-)
>  create mode 100644 src/conf/virnodedeviceobj.c
>  create mode 100644 src/conf/virnodedeviceobj.h

[...]

> diff --git a/src/conf/virnodedeviceobj.h b/src/conf/virnodedeviceobj.h
> new file mode 100644
> index 0000000..6ad7fb1
> --- /dev/null
> +++ b/src/conf/virnodedeviceobj.h
> @@ -0,0 +1,78 @@
> +/*
> + * virnodedeviceobj.h: node device object handling for node devices
> + *                     (derived from node_device_conf.h)
> + *
> + * This library is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * This library is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with this library.  If not, see
> + * <http://www.gnu.org/licenses/>.
> + */
> +
> +#ifndef __VIRNODEDEVICEOBJ_H__
> +# define __VIRNODEDEVICEOBJ_H__
> +
> +# include "internal.h"
> +# include "virthread.h"
> +
> +# include "node_device_conf.h"
> +# include "object_event.h"
> +
> +
> +typedef struct _virNodeDeviceDriverState virNodeDeviceDriverState;
> +typedef virNodeDeviceDriverState *virNodeDeviceDriverStatePtr;
> +struct _virNodeDeviceDriverState {
> +    virMutex lock;
> +
> +    virNodeDeviceObjList devs;		/* currently-known devices */
> +    void *privateData;			/* driver-specific private data */
> +
> +    /* Immutable pointer, self-locking APIs */
> +    virObjectEventStatePtr nodeDeviceEventState;
> +};
> +
> +

Since I'm the only one that tries to change the different coding style
between header and source files this is a kind reminder that it would
be nice to use the same coding style, placing the return value on
separate line.

Thanks,

Pavel

> +int virNodeDeviceHasCap(const virNodeDeviceObj *dev, const char *cap);
> +
> +virNodeDeviceObjPtr virNodeDeviceFindByName(virNodeDeviceObjListPtr devs,
> +                                            const char *name);
> +virNodeDeviceObjPtr
> +virNodeDeviceFindBySysfsPath(virNodeDeviceObjListPtr devs,
> +                             const char *sysfs_path)
> +    ATTRIBUTE_NONNULL(2);
> +
> +virNodeDeviceObjPtr virNodeDeviceAssignDef(virNodeDeviceObjListPtr devs,
> +                                           virNodeDeviceDefPtr def);
> +
> +void virNodeDeviceObjRemove(virNodeDeviceObjListPtr devs,
> +                            virNodeDeviceObjPtr *dev);
> +
> +int virNodeDeviceGetParentHost(virNodeDeviceObjListPtr devs,
> +                               virNodeDeviceDefPtr def,
> +                               int create);
> +
> +void virNodeDeviceObjFree(virNodeDeviceObjPtr dev);
> +
> +void virNodeDeviceObjListFree(virNodeDeviceObjListPtr devs);
> +
> +void virNodeDeviceObjLock(virNodeDeviceObjPtr obj);
> +void virNodeDeviceObjUnlock(virNodeDeviceObjPtr obj);
> +
> +typedef bool (*virNodeDeviceObjListFilter)(virConnectPtr conn,
> +                                           virNodeDeviceDefPtr def);
> +
> +int virNodeDeviceObjListExport(virConnectPtr conn,
> +                               virNodeDeviceObjList devobjs,
> +                               virNodeDevicePtr **devices,
> +                               virNodeDeviceObjListFilter filter,
> +                               unsigned int flags);
> +
> +#endif /* __VIRNODEDEVICEOBJ_H__ */
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index bce0487..8639979 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -694,23 +694,13 @@ virNetDevIPRouteParseXML;
>  virNodeDevCapsDefFree;
>  virNodeDevCapTypeFromString;
>  virNodeDevCapTypeToString;
> -virNodeDeviceAssignDef;
>  virNodeDeviceDefFormat;
>  virNodeDeviceDefFree;
>  virNodeDeviceDefParseFile;
>  virNodeDeviceDefParseNode;
>  virNodeDeviceDefParseString;
> -virNodeDeviceFindByName;
> -virNodeDeviceFindBySysfsPath;
> -virNodeDeviceGetParentHost;
>  virNodeDeviceGetParentName;
>  virNodeDeviceGetWWNs;
> -virNodeDeviceHasCap;
> -virNodeDeviceObjListExport;
> -virNodeDeviceObjListFree;
> -virNodeDeviceObjLock;
> -virNodeDeviceObjRemove;
> -virNodeDeviceObjUnlock;
>  
>  
>  # conf/node_device_event.h
> @@ -958,6 +948,19 @@ virDomainObjListRemoveLocked;
>  virDomainObjListRename;
>  
>  
> +# conf/virnodedeviceobj.h
> +virNodeDeviceAssignDef;
> +virNodeDeviceFindByName;
> +virNodeDeviceFindBySysfsPath;
> +virNodeDeviceGetParentHost;
> +virNodeDeviceHasCap;
> +virNodeDeviceObjListExport;
> +virNodeDeviceObjListFree;
> +virNodeDeviceObjLock;
> +virNodeDeviceObjRemove;
> +virNodeDeviceObjUnlock;
> +
> +
>  # conf/virsecretobj.h
>  virSecretLoadAllConfigs;
>  virSecretObjDeleteConfig;
> diff --git a/src/node_device/node_device_driver.h b/src/node_device/node_device_driver.h
> index 56f89ab..bc8af8a 100644
> --- a/src/node_device/node_device_driver.h
> +++ b/src/node_device/node_device_driver.h
> @@ -26,7 +26,7 @@
>  
>  # include "internal.h"
>  # include "driver.h"
> -# include "node_device_conf.h"
> +# include "virnodedeviceobj.h"
>  
>  # define LINUX_NEW_DEVICE_WAIT_TIME 60
>  
> diff --git a/src/test/test_driver.c b/src/test/test_driver.c
> index 314f08c..c6214c6 100644
> --- a/src/test/test_driver.c
> +++ b/src/test/test_driver.c
> @@ -51,6 +51,7 @@
>  #include "storage_conf.h"
>  #include "storage_event.h"
>  #include "node_device_conf.h"
> +#include "virnodedeviceobj.h"
>  #include "node_device_event.h"
>  #include "virxml.h"
>  #include "virthread.h"
> -- 
> 2.9.3
> 
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux