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

Re: [libvirt] sysinfo: cleanup function/struct names.



On Mon, Jun 27, 2011 at 04:39:34PM +0900, Minoru Usui wrote:
> Fix lack of 'virSysinfo' prefix of functions/structs in src/util/sysinfo.[ch]
> 
> diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c
> index fab4f06..3ff834e 100644
> 
> Signed-off-by: Minoru Usui <usui mxm nes nec co jp>
> ---
>  src/util/sysinfo.c |   44 ++++++++++++++++++++++++--------------------
>  src/util/sysinfo.h |   16 ++++++++--------
>  2 files changed, 32 insertions(+), 28 deletions(-)
> 
> diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c
> index fab4f06..31ebdc2 100644
> --- a/src/util/sysinfo.c
> +++ b/src/util/sysinfo.c
> @@ -128,7 +128,7 @@ virSysinfoRead(void) {
>  #else /* !WIN32 */
>  
>  static char *
> -parseBIOSInfo(char *base, virSysinfoDefPtr ret)
> +virSysinfoParseBIOS(char *base, virSysinfoDefPtr ret)
>  {
>      char *cur, *eol;
>  
> @@ -164,7 +164,7 @@ no_memory:
>  }
>  
>  static char *
> -parseSystemInfo(char *base, virSysinfoDefPtr ret)
> +virSysinfoParseSystem(char *base, virSysinfoDefPtr ret)
>  {
>      char *cur, *eol;
>  
> @@ -222,10 +222,10 @@ no_memory:
>  }
>  
>  static char *
> -parseProcessorInfo(char *base, virSysinfoDefPtr ret)
> +virSysinfoParseProcessor(char *base, virSysinfoDefPtr ret)
>  {
>      char *cur, *eol, *tmp_base;
> -    virProcessorinfoDefPtr processor;
> +    virSysinfoProcessorDefPtr processor;
>  
>      while((tmp_base = strstr(base, "Processor Information")) != NULL) {
>          base = tmp_base;
> @@ -323,10 +323,10 @@ no_memory:
>  }
>  
>  static char *
> -parseMemoryDeviceInfo(char *base, virSysinfoDefPtr ret)
> +virSysinfoParseMemory(char *base, virSysinfoDefPtr ret)
>  {
>      char *cur, *eol, *tmp_base;
> -    virMemoryDeviceinfoDefPtr memory;
> +    virSysinfoMemoryDefPtr memory;
>  
>      while ((tmp_base = strstr(base, "Memory Device")) != NULL) {
>          base = tmp_base;
> @@ -452,20 +452,20 @@ virSysinfoRead(void) {
>  
>      base = outbuf;
>  
> -    if ((base = parseBIOSInfo(base, ret)) == NULL)
> +    if ((base = virSysinfoParseBIOS(base, ret)) == NULL)
>          goto no_memory;
>  
> -    if ((base = parseSystemInfo(base, ret)) == NULL)
> +    if ((base = virSysinfoParseSystem(base, ret)) == NULL)
>          goto no_memory;
>  
>      ret->nprocessor = 0;
>      ret->processor = NULL;
> -    if ((base = parseProcessorInfo(base, ret)) == NULL)
> +    if ((base = virSysinfoParseProcessor(base, ret)) == NULL)
>          goto no_memory;
>  
>      ret->nmemory = 0;
>      ret->memory = NULL;
> -    if ((base = parseMemoryDeviceInfo(base, ret)) == NULL)
> +    if ((base = virSysinfoParseMemory(base, ret)) == NULL)
>          goto no_memory;
>  
>  cleanup:
> @@ -484,7 +484,8 @@ no_memory:
>  #endif /* !WIN32 */
>  
>  static void
> -BIOSInfoFormat(virSysinfoDefPtr def, const char *prefix, virBufferPtr buf)
> +virSysinfoBIOSFormat(virSysinfoDefPtr def, const char *prefix,
> +                     virBufferPtr buf)
>  {
>      int len = strlen(prefix);
>  
> @@ -522,7 +523,8 @@ BIOSInfoFormat(virSysinfoDefPtr def, const char *prefix, virBufferPtr buf)
>  }
>  
>  static void
> -SystemInfoFormat(virSysinfoDefPtr def, const char *prefix, virBufferPtr buf)
> +virSysinfoSystemFormat(virSysinfoDefPtr def, const char *prefix,
> +                       virBufferPtr buf)
>  {
>      int len = strlen(prefix);
>  
> @@ -580,11 +582,12 @@ SystemInfoFormat(virSysinfoDefPtr def, const char *prefix, virBufferPtr buf)
>  }
>  
>  static void
> -ProcessorInfoFormat(virSysinfoDefPtr def, const char *prefix, virBufferPtr buf)
> +virSysinfoProcessorFormat(virSysinfoDefPtr def, const char *prefix,
> +                          virBufferPtr buf)
>  {
>      int i;
>      int len = strlen(prefix);
> -    virProcessorinfoDefPtr processor;
> +    virSysinfoProcessorDefPtr processor;
>  
>      for (i = 0; i < def->nprocessor; i++) {
>          processor = &def->processor[i];
> @@ -675,11 +678,12 @@ ProcessorInfoFormat(virSysinfoDefPtr def, const char *prefix, virBufferPtr buf)
>  }
>  
>  static void
> -MemoryDeviceInfoFormat(virSysinfoDefPtr def, const char *prefix, virBufferPtr buf)
> +virSysinfoMemoryFormat(virSysinfoDefPtr def, const char *prefix,
> +                             virBufferPtr buf)
>  {
>      int i;
>      int len = strlen(prefix);
> -    virMemoryDeviceinfoDefPtr memory;
> +    virSysinfoMemoryDefPtr memory;
>  
>      for (i = 0; i < def->nmemory; i++) {
>          memory = &def->memory[i];
> @@ -785,10 +789,10 @@ virSysinfoFormat(virSysinfoDefPtr def, const char *prefix)
>  
>      virBufferAsprintf(&buf, "%s<sysinfo type='%s'>\n", prefix, type);
>  
> -    BIOSInfoFormat(def, prefix, &buf);
> -    SystemInfoFormat(def, prefix, &buf);
> -    ProcessorInfoFormat(def, prefix, &buf);
> -    MemoryDeviceInfoFormat(def, prefix, &buf);
> +    virSysinfoBIOSFormat(def, prefix, &buf);
> +    virSysinfoSystemFormat(def, prefix, &buf);
> +    virSysinfoProcessorFormat(def, prefix, &buf);
> +    virSysinfoMemoryFormat(def, prefix, &buf);
>  
>      virBufferAsprintf(&buf, "%s</sysinfo>\n", prefix);
>  
> diff --git a/src/util/sysinfo.h b/src/util/sysinfo.h
> index a15c5ac..86fd20f 100644
> --- a/src/util/sysinfo.h
> +++ b/src/util/sysinfo.h
> @@ -33,9 +33,9 @@ enum virSysinfoType {
>      VIR_SYSINFO_LAST
>  };
>  
> -typedef struct _virProcessorinfoDef virProcessorinfoDef;
> -typedef virProcessorinfoDef *virProcessorinfoDefPtr;
> -struct _virProcessorinfoDef {
> +typedef struct _virSysinfoProcessorDef virSysinfoProcessorDef;
> +typedef virSysinfoProcessorDef *virSysinfoProcessorDefPtr;
> +struct _virSysinfoProcessorDef {
>      char *processor_socket_destination;
>      char *processor_type;
>      char *processor_family;
> @@ -49,9 +49,9 @@ struct _virProcessorinfoDef {
>      char *processor_part_number;
>  };
>  
> -typedef struct _virMemoryDeviceinfoDef virMemoryDeviceinfoDef;
> -typedef virMemoryDeviceinfoDef *virMemoryDeviceinfoDefPtr;
> -struct _virMemoryDeviceinfoDef {
> +typedef struct _virSysinfoMemoryDef virSysinfoMemoryDef;
> +typedef virSysinfoMemoryDef *virSysinfoMemoryDefPtr;
> +struct _virSysinfoMemoryDef {
>      char *memory_size;
>      char *memory_form_factor;
>      char *memory_locator;
> @@ -83,10 +83,10 @@ struct _virSysinfoDef {
>      char *system_family;
>  
>      size_t nprocessor;
> -    virProcessorinfoDefPtr processor;
> +    virSysinfoProcessorDefPtr processor;
>  
>      size_t nmemory;
> -    virMemoryDeviceinfoDefPtr memory;
> +    virSysinfoMemoryDefPtr memory;
>  };
>  
>  virSysinfoDefPtr virSysinfoRead(void);

ACK


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


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