Ticket #3124: fbsd_compat.2.diff

File fbsd_compat.2.diff, 11.6 KB (added by Adek336, 15 years ago)
  • src/libs/compat/freebsd_network/if.c

     
    101101    driver_printf("%s: /dev/%s\n", gDriverName, ifp->device_name);
    102102
    103103    gDeviceNameList[ifp->if_index] = ifp->device_name;
     104    ktrace_printf("if_initname: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    104105    gDevices[ifp->if_index] = ifp;
    105106
    106107    ifp->root_device = find_root_device(unit);
     
    309310void
    310311ether_ifattach(struct ifnet *ifp, const uint8_t *macAddress)
    311312{
     313    ktrace_printf("ether_ifattach: a: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    312314    ifp->if_addrlen = ETHER_ADDR_LEN;
    313315    ifp->if_hdrlen = ETHER_HDR_LEN;
    314316    if_attach(ifp);
     
    324326    //      once all drivers are cleaned up.
    325327    if (macAddress != IFP2ENADDR(ifp))
    326328        memcpy(IFP2ENADDR(ifp), macAddress, ETHER_ADDR_LEN);
     329    ktrace_printf("ether_ifattach: b: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    327330}
    328331
    329332
  • src/libs/compat/freebsd_network/device.c

     
    3333            break;
    3434    }
    3535
     36    ktrace_printf("compat_open: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
     37
    3638    if (gDeviceNameList[i] == NULL)
    3739        return B_ERROR;
    3840
  • src/libs/compat/freebsd_network/compat/sys/haiku-module.h

     
    7474    void uninit_driver()                                                \
    7575        { _fbsd_uninit_driver(DRIVER_MODULE_NAME(name, busname)); }     \
    7676    const char **publish_devices()                                      \
    77         { return gDeviceNameList; }                                     \
     77        { ktrace_printf("publish_devices: gDeviceNameList[0]=%s\n", gDeviceNameList[0]); return gDeviceNameList; }                                      \
    7878    device_hooks *find_device(const char *name)                         \
    7979        { return &gDeviceHooks; }
    8080
  • src/libs/compat/freebsd_network/fbsd_mii.c

     
    192192{
    193193    struct mii_data     *mii;
    194194
     195    ktrace_printf("miibus_detach: a: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    195196    bus_generic_detach(dev);
     197    ktrace_printf("miibus_detach: b: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    196198    mii = device_get_softc(dev);
    197199    ifmedia_removeall(&mii->mii_media);
    198200    mii->mii_ifp = NULL;
     201    ktrace_printf("miibus_detach: c: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    199202
    200203    return(0);
    201204}
  • src/libs/compat/freebsd_network/compat.c

     
    377377    if (result == 0)
    378378        atomic_or(&device->flags, DEVICE_ATTACHED);
    379379
     380    ktrace_printf("device_attach: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
     381
    380382    return result;
    381383}
    382384
     
    384386int
    385387device_detach(device_t device)
    386388{
     389    ktrace_printf("device_detach: a: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    387390    if (device->driver == NULL)
    388391        return B_ERROR;
     392    ktrace_printf("device_detach: b: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    389393
    390394    if ((atomic_and(&device->flags, ~DEVICE_ATTACHED) & DEVICE_ATTACHED) != 0
    391395        && device->methods.detach != NULL) {
    392396        int result = device->methods.detach(device);
     397        ktrace_printf("device_detach: c: gDeviceNameList[0]=%s, result=0x%x\n", gDeviceNameList[0], result);
    393398        if (result != 0) {
    394399            atomic_or(&device->flags, DEVICE_ATTACHED);
    395400            return result;
     
    404409bus_generic_attach(device_t dev)
    405410{
    406411    device_t child = NULL;
     412    ktrace_printf("bus_generic_attach: a: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    407413
    408414    while ((child = list_get_next_item(&dev->children, child)) != NULL) {
    409415        if (child->driver == NULL) {
     
    418424        } else
    419425            child->methods.probe(child);
    420426
     427        ktrace_printf("bus_generic_attach: b: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    421428        if (child->driver != NULL) {
    422429            int result = device_attach(child);
    423430            if (result != 0)
    424431                return result;
    425432        }
    426433    }
     434    ktrace_printf("bus_generic_attach: c: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    427435
    428436    return 0;
    429437}
     
    433441bus_generic_detach(device_t device)
    434442{
    435443    device_t child = NULL;
     444    ktrace_printf("bus_generic_detach: a: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    436445
    437446    if ((device->flags & DEVICE_ATTACHED) == 0)
    438447        return B_ERROR;
    439448
     449    ktrace_printf("bus_generic_detach: c: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
     450
    440451    while (true) {
    441452        child = list_get_next_item(&device->children, child);
    442453        if (child == NULL)
    443454            break;
    444455
     456        ktrace_printf("bus_generic_detach: d: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    445457        device_detach(child);
    446458    }
     459    ktrace_printf("bus_generic_detach: e: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    447460
    448461    return 0;
    449462}
  • src/libs/compat/freebsd_network/driver.c

     
    5858        device_delete_child(NULL, root);
    5959        return B_NO_MEMORY;
    6060    }
     61    ktrace_printf("init_root_device: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    6162
    6263    root->driver = &sRootDriver;
    6364    root->root = root;
     
    9596    pci_info *info;
    9697    int i;
    9798
     99    ktrace_printf("_fbsd_init_hardware: a: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
     100
    98101    if (get_module(B_PCI_MODULE_NAME, (module_info **)&gPci) < B_OK)
    99102        return B_ERROR;
     103    ktrace_printf("_fbsd_init_hardware: b: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    100104
    101105    if (init_root_device(driver, &root, &child) != B_OK) {
    102106        dprintf("%s: creating device failed.\n", gDriverName);
    103107        put_module(B_PCI_MODULE_NAME);
    104108        return B_ERROR;
    105109    }
     110    ktrace_printf("_fbsd_init_hardware: c: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    106111
    107112    TRACE(("%s: init_hardware(%p)\n", gDriverName, driver));
    108113
     
    125130            break;
    126131        }
    127132    }
     133    ktrace_printf("_fbsd_init_hardware: d: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    128134
    129135    if (status < B_OK)
    130136        TRACE(("%s: no hardware found.\n", gDriverName));
     
    132138    device_delete_child(NULL, root);
    133139    put_module(B_PCI_MODULE_NAME);
    134140
     141    ktrace_printf("_fbsd_init_hardware: e: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
     142
    135143    return status;
    136144}
    137145
     
    142150    status_t status;
    143151    int i = 0;
    144152
     153    ktrace_printf("_fbsd_init_driver: a: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
     154
    145155    dprintf("%s: init_driver(%p)\n", gDriverName, driver);
    146156
    147157    status = get_module(B_PCI_MODULE_NAME, (module_info **)&gPci);
     
    169179        bool found = false;
    170180        pci_info *info;
    171181
     182        ktrace_printf("_fbsd_init_driver: b: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    172183        status = init_root_device(driver, &root, &device);
     184        ktrace_printf("_fbsd_init_driver: c: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    173185        if (status < B_OK)
    174186            break;
    175187
    176188        info = get_pci_info(root);
    177189
    178190        for (; gPci->get_nth_pci_info(i, info) == B_OK; i++) {
     191            ktrace_printf("_fbsd_init_driver: ca: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    179192            if (device->methods.probe(device) < 0)
    180193                continue;
    181194
     195            ktrace_printf("_fbsd_init_driver: d: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    182196            if (device_attach(device) == 0)
    183197                found = true;
     198            ktrace_printf("_fbsd_init_driver: e: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    184199
    185200            i++;
    186201            break;
     
    192207        }
    193208    }
    194209
     210    ktrace_printf("_fbsd_init_driver: f: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    195211    if (gDeviceCount > 0)
    196212        return B_OK;
    197213
     
    206222    uninit_mutexes();
    207223err1:
    208224    put_module(B_PCI_MODULE_NAME);
     225    ktrace_printf("_fbsd_init_driver: g: gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    209226    return status;
    210227}
    211228
  • src/add-ons/kernel/drivers/network/3com/pci/if_xl.c

     
    144144
    145145#include <pci/if_xlreg.h>
    146146
     147//QQQ
     148
     149extern const char *gDeviceNameList[];
     150
    147151/*
    148152 * TX Checksumming is disabled by default for two reasons:
    149153 * - TX Checksumming will occasionally produce corrupt packets
     
    10541058{
    10551059    struct xl_type      *t;
    10561060
     1061    ktrace_printf("3com: xl_probe, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
     1062
    10571063    t = xl_devs;
    10581064
    10591065    while (t->xl_name != NULL) {
     
    12241230    int         unit, error = 0, rid, res;
    12251231    uint16_t        did;
    12261232
     1233    ktrace_printf("3com: xl_attach: a, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
     1234
    12271235    sc = device_get_softc(dev);
    12281236    sc->xl_dev = dev;
    12291237   
     
    13531361        goto fail;
    13541362    }
    13551363    ifp->if_softc = sc;
     1364    ktrace_printf("3com: xl_attach: b, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    13561365    if_initname(ifp, device_get_name(dev), device_get_unit(dev));
     1366    ktrace_printf("3com: xl_attach: c, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    13571367
    13581368    /* Reset the adapter. */
    13591369    XL_LOCK(sc);
     
    13631373    /*
    13641374     * Get station address from the EEPROM.
    13651375     */
     1376    ktrace_printf("3com: xl_attach: d, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    13661377    if (xl_read_eeprom(sc, (caddr_t)&eaddr, XL_EE_OEM_ADR0, 3, 1)) {
    13671378        device_printf(dev, "failed to read station address\n");
    13681379        error = ENXIO;
    13691380        goto fail;
    13701381    }
     1382    ktrace_printf("3com: xl_attach: e, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    13711383
    13721384    sc->xl_unit = unit;
    13731385    callout_init_mtx(&sc->xl_stat_callout, &sc->xl_mtx, 0);
     
    16141626    }
    16151627
    16161628fail:
     1629    ktrace_printf("3com: xl_attach: f, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    16171630    if (error)
    16181631        xl_detach(dev);
     1632    ktrace_printf("3com: xl_attach: g, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    16191633
    16201634    return (error);
    16211635}
     
    16901704    sc = device_get_softc(dev);
    16911705    ifp = sc->xl_ifp;
    16921706
     1707    ktrace_printf("xl_detach: a, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
     1708
    16931709    KASSERT(mtx_initialized(&sc->xl_mtx), ("xl mutex not initialized"));
    16941710
    16951711#ifdef DEVICE_POLLING
     
    17301746    if (sc->xl_res)
    17311747        bus_release_resource(dev, res, rid, sc->xl_res);
    17321748
     1749    ktrace_printf("xl_detach: aa, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    17331750    if (ifp)
    17341751        if_free(ifp);
     1752    ktrace_printf("xl_detach: ab, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    17351753
    17361754    if (sc->xl_mtag) {
    17371755        bus_dmamap_destroy(sc->xl_mtag, sc->xl_tmpmap);
     
    17541772
    17551773    mtx_destroy(&sc->xl_mtx);
    17561774
     1775    ktrace_printf("xl_detach: b, gDeviceNameList[0]=%s\n", gDeviceNameList[0]);
    17571776    return (0);
    17581777}
    17591778
  • src/system/kernel/device_manager/devfs.cpp

     
    215215{
    216216    struct devfs_vnode* vnode;
    217217
     218    if (name[0] < 0)
     219        panic("devfs_create_vnode: name[0] < 0");
     220
    218221    vnode = (struct devfs_vnode*)malloc(sizeof(struct devfs_vnode));
    219222    if (vnode == NULL)
    220223        return NULL;
  • src/system/kernel/fs/vfs.cpp

     
    54705470            return B_BAD_ADDRESS;
    54715471
    54725472        ASSERT(entry->d_reclen >= sizeof(struct dirent));
     5473        ASSERT(entry->d_reclen <= sizeof(buffer));
    54735474
    54745475        if (user_memcpy(entry->d_name, userEntry->d_name,
    5475                 entry->d_reclen - sizeof(struct dirent)) != B_OK)
     5476                entry->d_reclen - sizeof(struct dirent) + 1) != B_OK)
    54765477            return B_BAD_ADDRESS;
    54775478    } else
    54785479        entry = userEntry;