[libvirt] [PATCH 14/14] secret: Introduce virSecretObjList

Daniel P. Berrange berrange at redhat.com
Fri Feb 26 17:16:35 UTC 2016


On Thu, Feb 25, 2016 at 09:03:18AM -0500, John Ferlan wrote:
> This patch replaces the listInsert and listUnlink with the more commonly
> used VIR_APPEND_ELEMENT and VIR_REMOVE_ELEMENT macros used for list mgmt.
> 
> Of course that does require any code walking the ->next list to instead
> use the ->count for loop
> 
> Signed-off-by: John Ferlan <jferlan at redhat.com>
> ---
>  src/secret/secret_driver.c | 244 +++++++++++++++++++++++----------------------
>  1 file changed, 124 insertions(+), 120 deletions(-)
> 
> diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
> index fb24237..deb8c59 100644
> --- a/src/secret/secret_driver.c
> +++ b/src/secret/secret_driver.c
> @@ -55,7 +55,6 @@ enum { SECRET_MAX_XML_FILE = 10*1024*1024 };
>  typedef struct _virSecretObj virSecretObj;
>  typedef virSecretObj *virSecretObjPtr;
>  struct _virSecretObj {
> -    virSecretObjPtr next;
>      char *configFile;
>      char *base64File;
>      virSecretDefPtr def;
> @@ -63,11 +62,18 @@ struct _virSecretObj {
>      size_t value_size;
>  };
>  
> +typedef struct _virSecretObjList virSecretObjList;
> +typedef virSecretObjList *virSecretObjListPtr;
> +struct _virSecretObjList {
> +    size_t count;
> +    virSecretObjPtr *objs;
> +};
> +
>  typedef struct _virSecretDriverState virSecretDriverState;
>  typedef virSecretDriverState *virSecretDriverStatePtr;
>  struct _virSecretDriverState {
>      virMutex lock;
> -    virSecretObj *secrets;
> +    virSecretObjList secrets;
>      char *configDir;
>  };

No objections to using an array, but if we consider the possibility
of having many 100's of guests, all using encrypted disks, or network
disks needing auth, then we would probably be better having a hash
table indexed on uuid, like we do for domains.

ACK

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list