Changeset 1916d1f in mainline for uspace/srv/fs/ext2fs/ext2fs_ops.c


Ignore:
Timestamp:
2011-07-12T13:41:26Z (13 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
50fc490
Parents:
11809eab (diff), 6817eba (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge libposix changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/ext2fs/ext2fs_ops.c

    r11809eab r1916d1f  
    240240        }
    241241       
    242         rc = ext2_directory_iterator_init(&it, fs, eparent->inode_ref);
     242        rc = ext2_directory_iterator_init(&it, fs, eparent->inode_ref, 0);
    243243        if (rc != EOK) {
    244244                return rc;
     
    478478        }
    479479       
    480         rc = ext2_directory_iterator_init(&it, fs, enode->inode_ref);
     480        rc = ext2_directory_iterator_init(&it, fs, enode->inode_ref, 0);
    481481        if (rc != EOK) {
    482482                EXT2FS_DBG("error %u", rc);
     
    818818{
    819819        ext2_directory_iterator_t it;
    820         aoff64_t cur;
     820        aoff64_t next;
    821821        uint8_t *buf;
    822822        size_t name_size;
     
    824824        bool found = false;
    825825       
    826         rc = ext2_directory_iterator_init(&it, inst->filesystem, inode_ref);
     826        rc = ext2_directory_iterator_init(&it, inst->filesystem, inode_ref, pos);
    827827        if (rc != EOK) {
    828828                async_answer_0(callid, rc);
     
    831831        }
    832832       
    833         /* Find the index we want to read
    834          * Note that we need to iterate and count as
    835          * the underlying structure is a linked list
    836          * Moreover, we want to skip . and .. entries
     833        /* Find next interesting directory entry.
     834         * We want to skip . and .. entries
    837835         * as these are not used in HelenOS
    838836         */
    839         cur = 0;
    840837        while (it.current != NULL) {
    841838                if (it.current->inode == 0) {
     
    851848                }
    852849               
    853                 /* Is this the dir entry we want to read? */
    854                 if (cur == pos) {
    855                         /* The on-disk entry does not contain \0 at the end
    856                          * end of entry name, so we copy it to new buffer
    857                          * and add the \0 at the end
    858                          */
    859                         buf = malloc(name_size+1);
    860                         if (buf == NULL) {
    861                                 ext2_directory_iterator_fini(&it);
    862                                 async_answer_0(callid, ENOMEM);
    863                                 async_answer_0(rid, ENOMEM);
    864                                 return;
    865                         }
    866                         memcpy(buf, &it.current->name, name_size);
    867                         *(buf+name_size) = 0;
    868                         found = true;
    869                         (void) async_data_read_finalize(callid, buf, name_size+1);
    870                         free(buf);
    871                         break;
    872                 }
    873                 cur++;
     850                /* The on-disk entry does not contain \0 at the end
     851                        * end of entry name, so we copy it to new buffer
     852                        * and add the \0 at the end
     853                        */
     854                buf = malloc(name_size+1);
     855                if (buf == NULL) {
     856                        ext2_directory_iterator_fini(&it);
     857                        async_answer_0(callid, ENOMEM);
     858                        async_answer_0(rid, ENOMEM);
     859                        return;
     860                }
     861                memcpy(buf, &it.current->name, name_size);
     862                *(buf+name_size) = 0;
     863                found = true;
     864                (void) async_data_read_finalize(callid, buf, name_size+1);
     865                free(buf);
     866                break;
    874867               
    875868skip:
     
    883876        }
    884877       
     878        if (found) {
     879                rc = ext2_directory_iterator_next(&it);
     880                if (rc != EOK) {
     881                        async_answer_0(rid, rc);
     882                        return;
     883                }
     884                next = it.current_offset;
     885        }
     886       
    885887        rc = ext2_directory_iterator_fini(&it);
    886888        if (rc != EOK) {
     
    890892       
    891893        if (found) {
    892                 async_answer_1(rid, EOK, 1);
     894                async_answer_1(rid, EOK, next-pos);
    893895        }
    894896        else {
Note: See TracChangeset for help on using the changeset viewer.