Ticket #3124: panic_at_vnode_name.diff

File panic_at_vnode_name.diff, 4.2 KB (added by Adek336, 16 years ago)
  • src/system/kernel/device_manager/legacy_drivers.cpp

     
    266266        // the device was not present before -> publish it now
    267267        TRACE(("devfs: publishing new device \"%s\"\n", devicePaths[0]));
    268268        device = new(std::nothrow) LegacyDevice(driver, devicePaths[0], hooks);
     269
     270        ktrace_printf("republish_driver: driver->path=%s, "
     271                "driver->name=%s, devicePaths[0]=%s\n",
     272                driver->path, driver->name, devicePaths[0]);
     273
    269274        if (device != NULL && device->InitCheck() == B_OK
    270275            && devfs_publish_device(devicePaths[0], device) == B_OK) {
    271276            driver->devices.Add(device);
     
    281286            continue;
    282287
    283288        TRACE(("devfs: unpublishing no more present \"%s\"\n", device->Path()));
     289        ktrace_printf("republish_device: unpublishing %s\n", device->Path());
    284290        iterator.Remove();
    285291
    286292        devfs_unpublish_device(device, true);
  • src/system/kernel/device_manager/devfs.cpp

     
    215215{
    216216    struct devfs_vnode* vnode;
    217217
     218    ktrace_printf("devfs_create_vnode: fs=%p, parent=%p, name=%s\n", fs,parent,name);
     219    if (name[0] < 0)
     220        panic("devfs_create_vnode: name[0] < 0");
     221
    218222    vnode = (struct devfs_vnode*)malloc(sizeof(struct devfs_vnode));
    219223    if (vnode == NULL)
    220224        return NULL;
     
    514518    if (tempPath.InitCheck() != B_OK)
    515519        return B_NO_MEMORY;
    516520
     521
     522    ktrace_printf("publish_directory: %s\n", path);
    517523    TRACE(("devfs: publish directory \"%s\"\n", path));
    518524    char *temp = tempPath.LockBuffer();
    519525
     
    584590    if (tempPath.InitCheck() != B_OK)
    585591        return B_NO_MEMORY;
    586592
     593    ktrace_printf("new_node: %s\n", path);
     594
    587595    char *temp = tempPath.LockBuffer();
    588596
    589597    // create the path leading to the device
     
    675683publish_device(struct devfs* fs, const char* path, BaseDevice* device)
    676684{
    677685    TRACE(("publish_device(path = \"%s\", device = %p)\n", path, device));
     686    ktrace_printf("publish_device: %s\n", path);
    678687
    679688    if (sDeviceFileSystem == NULL) {
    680689        panic("publish_device() called before devfs mounted\n");
  • src/system/kernel/fs/vfs.cpp

     
    54645464    char buffer[sizeof(struct dirent) + B_FILE_NAME_LENGTH];
    54655465    struct dirent* entry;
    54665466
     5467    bzero(&buffer, sizeof(buffer));
     5468
    54675469    if (IS_USER_ADDRESS(userEntry)) {
    54685470        entry = (struct dirent*)buffer;
    54695471        if (user_memcpy(entry, userEntry, sizeof(struct dirent) - 1) != B_OK)
     
    54715473
    54725474        ASSERT(entry->d_reclen >= sizeof(struct dirent));
    54735475
     5476        if ( entry->d_reclen > sizeof(buffer))
     5477        {
     5478            char tmpBuf[2048];
     5479            char *pos = tmpBuf;
     5480            unsigned i;
     5481
     5482            for (i = 0; i < entry->d_reclen - sizeof(struct dirent) + 1; i++)
     5483                pos += sprintf(pos, "%02x ", (unsigned char)(userEntry->d_name[i]));
     5484
     5485            ktrace_printf("fix_dirent: name is %s\n", tmpBuf);
     5486
     5487            panic("%d = entry->d_reclen > sizeof(buffer) = %d", entry->d_reclen, (unsigned)sizeof(buffer));
     5488
     5489            entry->d_reclen = sizeof(buffer) - 1;
     5490        }
     5491
    54745492        if (user_memcpy(entry->d_name, userEntry->d_name,
    5475                 entry->d_reclen - sizeof(struct dirent)) != B_OK)
     5493                entry->d_reclen - sizeof(struct dirent) + 1) != B_OK)
    54765494            return B_BAD_ADDRESS;
    54775495    } else
    54785496        entry = userEntry;
    54795497
     5498    ktrace_printf("fix_dirent: _length=%p, entry=%p, parent=%p, entry->d_name=%s\n",
     5499            _length, entry,parent, entry->d_name);
    54805500    *_length = entry->d_reclen;
    54815501
    54825502    // set d_pdev and d_pino
     
    55495569    if (count > 0) {
    55505570        for (uint32 i = 0; i < count; i++) {
    55515571            uint32 length;
     5572            ktrace_printf("dir_read: cookie=%p, _count=%p, count=%d, i=%d, bufferSize=%d\n",
     5573                    cookie, _count, (unsigned)count, (unsigned)i, (unsigned)bufferSize);
     5574            ktrace_printf("fix_dirent args: parent=%p, userEntry=%p, ioContext=%p, _length=%p\n",
     5575                    vnode, buffer, ioContext, &length);
    55525576            error = fix_dirent(vnode, buffer, ioContext, &length);
    55535577            if (error != B_OK)
    55545578                return error;