Changeset 8071af9f in mainline for pci/libpci/names.c


Ignore:
Timestamp:
2006-05-14T09:33:09Z (19 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8a568e3
Parents:
57ff9ab
Message:

Add GPL for reference and add modification dates into libpci to better comply with GPL.
Also, do some formatting changes in libpci.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pci/libpci/names.c

    r57ff9ab r8071af9f  
    44 *      Copyright (c) 1997--2005 Martin Mares <mj@ucw.cz>
    55 *
    6  *      Modified and ported to HelenOS by Jakub Jermar.
     6 *      May 8, 2006 - Modified and ported to HelenOS by Jakub Jermar.
    77 *
    88 *      Can be freely distributed and used under the terms of the GNU GPL.
     
    176176                if (!nest) {    /* Top-level entries */
    177177                        if (p[0] == 'C' && p[1] == ' ') {       /* Class block */
    178                                 if ((id1 = id_hex(p + 2, 2)) < 0
    179                                     || !id_white_p(p[4]))
     178                                if ((id1 = id_hex(p + 2, 2)) < 0 || !id_white_p(p[4]))
    180179                                        return parse_error;
    181180                                cat = ID_CLASS;
     
    193192                        } else {        /* Vendor ID */
    194193
    195                                 if ((id1 = id_hex(p, 4)) < 0
    196                                     || !id_white_p(p[4]))
     194                                if ((id1 = id_hex(p, 4)) < 0 || !id_white_p(p[4]))
    197195                                        return parse_error;
    198196                                cat = ID_VENDOR;
     
    207205                        case ID_DEVICE:
    208206                        case ID_SUBSYSTEM:
    209                                 if ((id2 = id_hex(p, 4)) < 0
    210                                     || !id_white_p(p[4]))
     207                                if ((id2 = id_hex(p, 4)) < 0 || !id_white_p(p[4]))
    211208                                        return parse_error;
    212209                                p += 5;
     
    215212                                break;
    216213                        case ID_GEN_SUBSYSTEM:
    217                                 if ((id2 = id_hex(p, 4)) < 0
    218                                     || !id_white_p(p[4]))
     214                                if ((id2 = id_hex(p, 4)) < 0 || !id_white_p(p[4]))
    219215                                        return parse_error;
    220216                                p += 5;
     
    224220                        case ID_SUBCLASS:
    225221                        case ID_PROGIF:
    226                                 if ((id2 = id_hex(p, 2)) < 0
    227                                     || !id_white_p(p[2]))
     222                                if ((id2 = id_hex(p, 2)) < 0 || !id_white_p(p[2]))
    228223                                        return parse_error;
    229224                                p += 3;
     
    237232                        case ID_DEVICE:
    238233                        case ID_SUBSYSTEM:
    239                                 if ((id3 = id_hex(p, 4)) < 0
    240                                     || !id_white_p(p[4])
    241                                     || (id4 = id_hex(p + 5, 4)) < 0
    242                                     || !id_white_p(p[9]))
     234                                if ((id3 = id_hex(p, 4)) < 0 || !id_white_p(p[4])
     235                                    || (id4 = id_hex(p + 5, 4)) < 0 || !id_white_p(p[9]))
    243236                                        return parse_error;
    244237                                p += 10;
     
    248241                        case ID_SUBCLASS:
    249242                        case ID_PROGIF:
    250                                 if ((id3 = id_hex(p, 2)) < 0
    251                                     || !id_white_p(p[2]))
     243                                if ((id3 = id_hex(p, 2)) < 0 || !id_white_p(p[2]))
    252244                                        return parse_error;
    253245                                p += 3;
     
    342334                        return (char *) v->name;
    343335                else
    344                         res =
    345                             snprintf(buf, size, "Unknown vendor %04x", iv);
     336                        res = snprintf(buf, size, "Unknown vendor %04x", iv);
    346337                break;
    347338        case PCI_LOOKUP_DEVICE:
     
    353344                        return (char *) d->name;
    354345                else if (synth)
    355                         res =
    356                             snprintf(buf, size, "Unknown device %04x", id);
     346                        res = snprintf(buf, size, "Unknown device %04x", id);
    357347                else
    358348                        return NULL;
     
    367357                        d = id_lookup(a, ID_DEVICE, iv, id, 0, 0);
    368358                        if (v && d)
    369                                 res =
    370                                     snprintf(buf, size, "%s %s", v->name,
     359                                res = snprintf(buf, size, "%s %s", v->name,
    371360                                             d->name);
    372361                        else if (!synth)
    373362                                return NULL;
    374363                        else if (!v)
    375                                 res =
    376                                     snprintf(buf, size,
    377                                              "Unknown device %04x:%04x",
    378                                              iv, id);
     364                                res = snprintf(buf, size, "Unknown device %04x:%04x", iv, id);
    379365                        else    /* !d */
    380                                 res =
    381                                     snprintf(buf, size,
    382                                              "%s Unknown device %04x",
    383                                              v->name, id);
     366                                res = snprintf(buf, size, "%s Unknown device %04x", v->name, id);
    384367                }
    385368                break;
     
    391374                        return (char *) v->name;
    392375                else if (synth)
    393                         res =
    394                             snprintf(buf, size, "Unknown vendor %04x",
    395                                      isv);
     376                        res = snprintf(buf, size, "Unknown vendor %04x", isv);
    396377                else
    397378                        return NULL;
     
    407388                        return (char *) d->name;
    408389                else if (synth)
    409                         res =
    410                             snprintf(buf, size, "Unknown device %04x",
    411                                      isd);
     390                        res = snprintf(buf, size, "Unknown device %04x", isd);
    412391                else
    413392                        return NULL;
     
    424403                        d = id_lookup_subsys(a, iv, id, isv, isd);
    425404                        if (v && d)
    426                                 res =
    427                                     snprintf(buf, size, "%s %s", v->name,
    428                                              d->name);
     405                                res = snprintf(buf, size, "%s %s", v->name, d->name);
    429406                        else if (!synth)
    430407                                return NULL;
    431408                        else if (!v)
    432                                 res =
    433                                     snprintf(buf, size,
    434                                              "Unknown device %04x:%04x",
    435                                              isv, isd);
     409                                res = snprintf(buf, size, "Unknown device %04x:%04x", isv, isd);
    436410                        else    /* !d */
    437                                 res =
    438                                     snprintf(buf, size,
    439                                              "%s Unknown device %04x",
    440                                              v->name, isd);
     411                                res = snprintf(buf, size, "%s Unknown device %04x", v->name, isd);
    441412                }
    442413                break;
     
    445416                if (num)
    446417                        res = snprintf(buf, size, "%04x", icls);
    447                 else if (cls =
    448                          id_lookup(a, ID_SUBCLASS, icls >> 8, icls & 0xff,
    449                                    0, 0))
     418                else if (cls = id_lookup(a, ID_SUBCLASS, icls >> 8, icls & 0xff, 0, 0))
    450419                        return (char *) cls->name;
    451420                else if (cls = id_lookup(a, ID_CLASS, icls, 0, 0, 0))
    452                         res =
    453                             snprintf(buf, size, "%s [%04x]", cls->name,
    454                                      icls);
     421                        res = snprintf(buf, size, "%s [%04x]", cls->name, icls);
    455422                else if (synth)
    456423                        res = snprintf(buf, size, "Class %04x", icls);
     
    463430                if (num)
    464431                        res = snprintf(buf, size, "%02x", ipif);
    465                 else if (pif =
    466                          id_lookup(a, ID_PROGIF, icls >> 8, icls & 0xff,
    467                                    ipif, 0))
     432                else if (pif = id_lookup(a, ID_PROGIF, icls >> 8, icls & 0xff, ipif, 0))
    468433                        return (char *) pif->name;
    469434                else if (icls == 0x0101 && !(ipif & 0x70)) {
Note: See TracChangeset for help on using the changeset viewer.