Ticket #3124: fix_dirent-line-numbers.diff

File fix_dirent-line-numbers.diff, 2.3 KB (added by Adek336, 11 years ago)

line numbers tracing in fix_dirent()

  • vfs.cpp

     
    54615461fix_dirent(struct vnode *parent, struct dirent *userEntry,
    54625462    struct io_context* ioContext, uint32* _length)
    54635463{
     5464#define lnd do { ktrace_printf("fix_dirent: %d\n", __LINE__); } while(0)
    54645465    char buffer[sizeof(struct dirent) + B_FILE_NAME_LENGTH];
    54655466    struct dirent* entry;
    54665467
    54675468    if (IS_USER_ADDRESS(userEntry)) {
     5469      lnd;
    54685470        entry = (struct dirent*)buffer;
    54695471        if (user_memcpy(entry, userEntry, sizeof(struct dirent) - 1) != B_OK)
    54705472            return B_BAD_ADDRESS;
     
    54765478            return B_BAD_ADDRESS;
    54775479    } else
    54785480        entry = userEntry;
     5481   lnd;
    54795482
    54805483    *_length = entry->d_reclen;
    54815484
    54825485    // set d_pdev and d_pino
    54835486    entry->d_pdev = parent->device;
    54845487    entry->d_pino = parent->id;
     5488   lnd;
    54855489
    54865490    // If this is the ".." entry and the directory is the root of a FS,
    54875491    // we need to replace d_dev and d_ino with the actual values.
    54885492    if (strcmp(entry->d_name, "..") == 0
    54895493        && parent->mount->root_vnode == parent
    54905494        && parent->mount->covers_vnode) {
     5495      lnd;
    54915496        inc_vnode_ref_count(parent);
    54925497            // vnode_path_to_vnode() puts the node
    54935498
    54945499        // Make sure the IO context root is not bypassed.
    54955500        if (parent == ioContext->root) {
     5501         lnd;
    54965502            entry->d_dev = parent->device;
    54975503            entry->d_ino = parent->id;
    54985504        } else {
     5505         lnd;
    54995506            // ".." is guaranteed not to be clobbered by this call
    55005507            struct vnode *vnode;
    55015508            status_t status = vnode_path_to_vnode(parent, (char*)"..", false, 0,
     
    55075514            }
    55085515        }
    55095516    } else {
     5517      lnd;
    55105518        // resolve mount points
    55115519        struct vnode *vnode = NULL;
    55125520        status_t status = get_vnode(entry->d_dev, entry->d_ino, &vnode, true,
     
    55145522        if (status != B_OK)
    55155523            return status;
    55165524
     5525      lnd;
    55175526        mutex_lock(&sVnodeCoveredByMutex);
    55185527        if (vnode->covered_by) {
    55195528            entry->d_dev = vnode->covered_by->device;
     
    55225531        mutex_unlock(&sVnodeCoveredByMutex);
    55235532
    55245533        put_vnode(vnode);
     5534      lnd;
    55255535    }
     5536   lnd;
    55265537
    55275538    // copy back from userland buffer if needed
    55285539    if (entry != userEntry)
    5529         return user_memcpy(userEntry, entry, sizeof(struct dirent) - 1);
     5540   {
     5541      status_t st;
     5542      lnd;
     5543        st= user_memcpy(userEntry, entry, sizeof(struct dirent) - 1);
     5544      lnd;
     5545      return st;
     5546   }
    55305547
     5548   lnd;
    55315549    return B_OK;
     5550#undef lnd
    55325551}
    55335552
    55345553