Run Nindent on com32/gpllib/vpd/vpd.c
authorH. Peter Anvin <hpa@zytor.com>
Fri, 29 May 2009 22:10:21 +0000 (15:10 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Fri, 29 May 2009 22:10:21 +0000 (15:10 -0700)
Automatically reformat com32/gpllib/vpd/vpd.c using Nindent.

Do this for all files except HDT, gPXE and externally maintained
libraries (zlib, tinyjpeg, libpng).

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
com32/gpllib/vpd/vpd.c

index ff04b8b..fd468e4 100644 (file)
 
 int vpd_checksum(char *buf, int len)
 {
-        uint8_t sum=0;
-        int a;
+    uint8_t sum = 0;
+    int a;
 
-        for(a=0; a<len; a++)
-                sum+=buf[a];
-        return (sum==0);
+    for (a = 0; a < len; a++)
+       sum += buf[a];
+    return (sum == 0);
 }
 
-int vpd_decode(s_vpd *vpd) {
-  uint8_t buf[16];
-  char *p,*q;
+int vpd_decode(s_vpd * vpd)
+{
+    uint8_t buf[16];
+    char *p, *q;
 
-  /* Cleaning structures */
-  memset(&vpd->base_address,0,sizeof (vpd->base_address));
-  memset(&vpd->bios_build_id,0,sizeof (vpd->bios_build_id));
-  memset(&vpd->box_serial_number,0,sizeof (vpd->box_serial_number));
-  memset(&vpd->motherboard_serial_number,0,sizeof (vpd->motherboard_serial_number));
-  memset(&vpd->machine_type_model,0,sizeof (vpd->machine_type_model));
-  memset(&vpd->bios_release_date,0,sizeof (vpd->bios_release_date));
-  memset(&vpd->default_flash_filename,0,sizeof (vpd->default_flash_filename));
-  memset(&vpd->bios_version,0,sizeof (vpd->bios_version));
+    /* Cleaning structures */
+    memset(&vpd->base_address, 0, sizeof(vpd->base_address));
+    memset(&vpd->bios_build_id, 0, sizeof(vpd->bios_build_id));
+    memset(&vpd->box_serial_number, 0, sizeof(vpd->box_serial_number));
+    memset(&vpd->motherboard_serial_number, 0,
+          sizeof(vpd->motherboard_serial_number));
+    memset(&vpd->machine_type_model, 0, sizeof(vpd->machine_type_model));
+    memset(&vpd->bios_release_date, 0, sizeof(vpd->bios_release_date));
+    memset(&vpd->default_flash_filename, 0,
+          sizeof(vpd->default_flash_filename));
+    memset(&vpd->bios_version, 0, sizeof(vpd->bios_version));
 
-  /* Until we found elements in the vpdtable, we consider them as not filled */
-  vpd->filled=false;
+    /* Until we found elements in the vpdtable, we consider them as not filled */
+    vpd->filled = false;
 
-  p=(char *)0xF0000; /* The start address to look at the dmi table */
-  for (q = p; q < p + 0x10000; q +=4) {
-        memcpy(buf, q, 5);
-        if(memcmp(buf, "\252\125VPD", 5)==0) {
-            snprintf(&vpd->base_address,5,"%X",q);
-             if (q[5] < 0x30)
-                 return -ENOVPDTABLE;
+    p = (char *)0xF0000;       /* The start address to look at the dmi table */
+    for (q = p; q < p + 0x10000; q += 4) {
+       memcpy(buf, q, 5);
+       if (memcmp(buf, "\252\125VPD", 5) == 0) {
+           snprintf(&vpd->base_address, 5, "%X", q);
+           if (q[5] < 0x30)
+               return -ENOVPDTABLE;
 
-            vpd->filled=true;
-             /* XSeries have longer records, exact length seems to vary. */
-             if (!(q[5] >= 0x45 && vpd_checksum(q, q[5]))
-               /* Some Netvista seem to work with this. */
-               && !(vpd_checksum(q, 0x30))
-               /* The Thinkpad/Thinkcentre checksum does *not* include the first 13 bytes. */
-               && !(vpd_checksum(q + 0x0D, 0x30 - 0x0D)))
-               {
-                /* A few systems have a bad checksum (xSeries 325, 330, 335
-                   and 345 with early BIOS) but the record is otherwise
-                   valid. */
-                        printf("VPD: Bad checksum!\n");
-               }
+           vpd->filled = true;
+           /* XSeries have longer records, exact length seems to vary. */
+           if (!(q[5] >= 0x45 && vpd_checksum(q, q[5]))
+               /* Some Netvista seem to work with this. */
+               && !(vpd_checksum(q, 0x30))
+               /* The Thinkpad/Thinkcentre checksum does *not* include the first 13 bytes. */
+               && !(vpd_checksum(q + 0x0D, 0x30 - 0x0D))) {
+               /* A few systems have a bad checksum (xSeries 325, 330, 335
+                  and 345 with early BIOS) but the record is otherwise
+                  valid. */
+               printf("VPD: Bad checksum!\n");
+           }
 
-             strncpy(vpd->bios_build_id,q+0x0D, 9);
-             strncpy(vpd->box_serial_number,q+0x16, 7);
-             strncpy(vpd->motherboard_serial_number,q+0x1D, 11);
-             strncpy(vpd->machine_type_model,q+0x28, 7);
+           strncpy(vpd->bios_build_id, q + 0x0D, 9);
+           strncpy(vpd->box_serial_number, q + 0x16, 7);
+           strncpy(vpd->motherboard_serial_number, q + 0x1D, 11);
+           strncpy(vpd->machine_type_model, q + 0x28, 7);
 
-            if (q[5] < 0x44)
-                return VPD_TABLE_PRESENT;
+           if (q[5] < 0x44)
+               return VPD_TABLE_PRESENT;
 
-             strncpy(vpd->bios_release_date,q+0x30, 8);
-             strncpy(vpd->default_flash_filename,q+0x38, 12);
+           strncpy(vpd->bios_release_date, q + 0x30, 8);
+           strncpy(vpd->default_flash_filename, q + 0x38, 12);
 
-            if (q[5] >= 0x46 && q[0x44] != 0x00) {
-                    strncpy(vpd->bios_version,q+0x44, 255);
-            }
+           if (q[5] >= 0x46 && q[0x44] != 0x00) {
+               strncpy(vpd->bios_version, q + 0x44, 255);
+           }
 
-             return VPD_TABLE_PRESENT;
-         }
-  }
-  return -ENOVPDTABLE;
+           return VPD_TABLE_PRESENT;
+       }
+    }
+    return -ENOVPDTABLE;
 }
-
-