Re: [RFC PATCH 1/3] driver: Implement new state driver field

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

 



On 12/21/13 05:14, Adam Walters wrote:
> This implements a new field in the virStateDriver struct. In order to prevent possible compilation issues, this patch also implements te new field in all of the existing drivers. Other than in driver.h, the changes are all a single line addition to the files.

Please break this long line as advised in 2/3.

> 
> Signed-off-by: Adam Walters <adam@xxxxxxxxxxxxxxxxx>
> ---
>  src/config/config_driver.c              | 1 +
>  src/driver.h                            | 6 ++++++
>  src/interface/interface_backend_netcf.c | 1 +
>  src/libxl/libxl_driver.c                | 1 +
>  src/lxc/lxc_driver.c                    | 1 +
>  src/network/bridge_driver.c             | 1 +
>  src/node_device/node_device_hal.c       | 1 +
>  src/node_device/node_device_udev.c      | 1 +
>  src/nwfilter/nwfilter_driver.c          | 1 +
>  src/qemu/qemu_driver.c                  | 1 +
>  src/remote/remote_driver.c              | 1 +
>  src/secret/secret_driver.c              | 1 +
>  src/storage/storage_driver.c            | 1 +
>  src/uml/uml_driver.c                    | 1 +
>  src/xen/xen_driver.c                    | 1 +
>  15 files changed, 20 insertions(+)
> 
> diff --git a/src/config/config_driver.c b/src/config/config_driver.c
> index a057300..a817c7a 100644
> --- a/src/config/config_driver.c
> +++ b/src/config/config_driver.c
> @@ -228,6 +228,7 @@ static virStateDriver configStateDriver = {
>      .stateInitialize = configStateInitialize,
>      .stateCleanup = configStateCleanup,
>      .stateReload = configStateReload,
> +    .stateType = VIR_DRV_STATE_DRV_LIBVIRT,
>  };
>  
>  int configRegister(void) {
> diff --git a/src/driver.h b/src/driver.h
> index b6927ea..6863910 100644
> --- a/src/driver.h
> +++ b/src/driver.h
> @@ -1833,6 +1833,11 @@ typedef int
>  typedef int
>  (*virDrvStateStop)(void);
>  
> +typedef enum {
> +    VIR_DRV_STATE_DRV_LIBVIRT = 1,
> +    VIR_DRV_STATE_DRV_HYPERVISOR = 2,
> +} virDrvStateDrvType;
> +
>  typedef struct _virStateDriver virStateDriver;
>  typedef virStateDriver *virStateDriverPtr;
>  
> @@ -1843,6 +1848,7 @@ struct _virStateDriver {
>      virDrvStateCleanup stateCleanup;
>      virDrvStateReload stateReload;
>      virDrvStateStop stateStop;
> +    virDrvStateDrvType stateType;
>  };
>  # endif

These additions require patching some of the check scripts too. 
Please apply the following patch, otherwise this won't pass make check:

  GEN      check-drivername
Driver struct field stateType should be named stateDrvType
  GEN      check-driverimpls
./libxl/libxl_driver.c:26463 Bad prefix 'VIR_DRV_STATE_DRV_HYPERVISOR' for API 'stateType', expecting 'libxl'
./libxl/libxl_driver.c:26463 Bad impl name 'VIR_DRV_STATE_DRV_HYPERVISOR' for API 'stateType', expecting 'libxlStateType'
./lxc/lxc_driver.c:37541 Bad prefix 'VIR_DRV_STATE_DRV_HYPERVISOR' for API 'stateType', expecting 'lxc'
./lxc/lxc_driver.c:37541 Bad impl name 'VIR_DRV_STATE_DRV_HYPERVISOR' for API 'stateType', expecting 'lxcStateType'


diff --git a/src/check-driverimpls.pl b/src/check-driverimpls.pl
index f726403..2266323 100755
--- a/src/check-driverimpls.pl
+++ b/src/check-driverimpls.pl
@@ -37,7 +37,7 @@ while (<>) {

             next if $api eq "no";
             next if $api eq "name";
+            next if $api eq "stateType";

             my $suffix = $impl;
             my $prefix = $impl;
diff --git a/src/check-drivername.pl b/src/check-drivername.pl
index 5c8de0a..d481128 100755
--- a/src/check-drivername.pl
+++ b/src/check-drivername.pl
@@ -66,6 +66,8 @@ while (<DRVFILE>) {
         my $drv = $1;
         my $field = $2;

+        next if $field =~ /stateType/;
+
         my $tmp = $drv;
         $tmp =~ s/virDrv//;
         $tmp =~ s/^NWFilter/nwfilter/;

Or possibly don't apply the last hunk and re-name the field to
stateDrvType which sounds a little bit better (not required).

Peter




Attachment: signature.asc
Description: OpenPGP 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]