Re: [PATCH 4/6] vbox: Add more IStorageController API mappings.

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

 




On 10/09/2017 04:49 PM, Dawid Zamirski wrote:
> From: Dawid Zamirski <dzamirski@xxxxxxxxx>
> 
> This patch 'maps' additonal methods for VBOX API to the libvirt unified

"for the VBOX API"

additional

> vbox API to deal with IStorageController. The 'mapped' methods are:
> 
> * IStorageController->GetStorageControllerType()
> * IStorageController->SetStorageControllerType()
> * IMachine->GetStorageControllers()
> ---
>  src/vbox/vbox_common.h        | 13 +++++++++++++
>  src/vbox/vbox_tmpl.c          | 20 ++++++++++++++++++++
>  src/vbox/vbox_uniformed_api.h |  3 +++
>  3 files changed, 36 insertions(+)
> 

This seems reasonable.... Even though there's some style differences
with how we generally like to see libvirt code - it follows the style of
other vbox code and to me that perhaps more important.

Reviewed-by: John Ferlan <jferlan@xxxxxxxxxx>

John

> diff --git a/src/vbox/vbox_common.h b/src/vbox/vbox_common.h
> index c6da8929d..b08ad1e3e 100644
> --- a/src/vbox/vbox_common.h
> +++ b/src/vbox/vbox_common.h
> @@ -235,6 +235,19 @@ enum StorageBus
>      StorageBus_SAS = 5
>  };
>  
> +enum StorageControllerType
> +{
> +    StorageControllerType_Null = 0,
> +    StorageControllerType_LsiLogic = 1,
> +    StorageControllerType_BusLogic = 2,
> +    StorageControllerType_IntelAhci = 3,
> +    StorageControllerType_PIIX3 = 4,
> +    StorageControllerType_PIIX4 = 5,
> +    StorageControllerType_ICH6 = 6,
> +    StorageControllerType_I82078 = 7,
> +    StorageControllerType_LsiLogicSas = 8
> +};
> +
>  enum AccessMode
>  {
>      AccessMode_ReadOnly = 1,
> diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
> index ac3b8fa00..6592cbd63 100644
> --- a/src/vbox/vbox_tmpl.c
> +++ b/src/vbox/vbox_tmpl.c
> @@ -550,6 +550,11 @@ static void* _handleUSBGetDeviceFilters(IUSBCommon *USBCommon)
>      return USBCommon->vtbl->GetDeviceFilters;
>  }
>  
> +static void* _handleMachineGetStorageControllers(IMachine *machine)
> +{
> +    return machine->vtbl->GetStorageControllers;
> +}
> +
>  static void* _handleMachineGetMediumAttachments(IMachine *machine)
>  {
>      return machine->vtbl->GetMediumAttachments;
> @@ -1919,6 +1924,18 @@ _storageControllerGetBus(IStorageController *storageController, PRUint32 *bus)
>      return storageController->vtbl->GetBus(storageController, bus);
>  }
>  
> +static nsresult
> +_storageControllerGetControllerType(IStorageController *storageController, PRUint32 *controllerType)
> +{
> +    return storageController->vtbl->GetControllerType(storageController, controllerType);
> +}
> +
> +static nsresult
> +_storageControllerSetControllerType(IStorageController *storageController, PRUint32 controllerType)
> +{
> +    return storageController->vtbl->SetControllerType(storageController, controllerType);
> +}
> +
>  static nsresult
>  _sharedFolderGetHostPath(ISharedFolder *sharedFolder, PRUnichar **hostPath)
>  {
> @@ -2268,6 +2285,7 @@ static vboxUniformedArray _UArray = {
>      .handleGetMachines = _handleGetMachines,
>      .handleGetHardDisks = _handleGetHardDisks,
>      .handleUSBGetDeviceFilters = _handleUSBGetDeviceFilters,
> +    .handleMachineGetStorageControllers = _handleMachineGetStorageControllers,
>      .handleMachineGetMediumAttachments = _handleMachineGetMediumAttachments,
>      .handleMachineGetSharedFolders = _handleMachineGetSharedFolders,
>      .handleSnapshotGetChildren = _handleSnapshotGetChildren,
> @@ -2499,6 +2517,8 @@ static vboxUniformedIMediumAttachment _UIMediumAttachment = {
>  
>  static vboxUniformedIStorageController _UIStorageController = {
>      .GetBus = _storageControllerGetBus,
> +    .GetControllerType = _storageControllerGetControllerType,
> +    .SetControllerType = _storageControllerSetControllerType,
>  };
>  
>  static vboxUniformedISharedFolder _UISharedFolder = {
> diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h
> index 2ccaf43e8..dc0b391b2 100644
> --- a/src/vbox/vbox_uniformed_api.h
> +++ b/src/vbox/vbox_uniformed_api.h
> @@ -135,6 +135,7 @@ typedef struct {
>      void* (*handleGetMachines)(IVirtualBox *vboxObj);
>      void* (*handleGetHardDisks)(IVirtualBox *vboxObj);
>      void* (*handleUSBGetDeviceFilters)(IUSBCommon *USBCommon);
> +    void* (*handleMachineGetStorageControllers)(IMachine *machine);
>      void* (*handleMachineGetMediumAttachments)(IMachine *machine);
>      void* (*handleMachineGetSharedFolders)(IMachine *machine);
>      void* (*handleSnapshotGetChildren)(ISnapshot *snapshot);
> @@ -410,6 +411,8 @@ typedef struct {
>  /* Functions for IStorageController */
>  typedef struct {
>      nsresult (*GetBus)(IStorageController *storageController, PRUint32 *bus);
> +    nsresult (*SetControllerType)(IStorageController *storageController, PRUint32 controllerType);
> +    nsresult (*GetControllerType)(IStorageController *storageController, PRUint32 *controllerType);
>  } vboxUniformedIStorageController;
>  
>  /* Functions for ISharedFolder */
> 

--
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