Changeset 59c0777 in mainline


Ignore:
Timestamp:
2011-08-02T19:36:08Z (13 years ago)
Author:
Oleg Romanenko <romanenko.oleg@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0bd5ff1
Parents:
8f54827
Message:

Implement exfat_has_children

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/exfat/exfat_ops.c

    r8f54827 r59c0777  
    481481int exfat_has_children(bool *has_children, fs_node_t *fn)
    482482{
     483        exfat_directory_t di;
     484        exfat_dentry_t *d;
     485        exfat_node_t *nodep = EXFAT_NODE(fn);
     486        int rc;
     487
    483488        *has_children = false;
    484         return EOK;
     489
     490        if (nodep->type != EXFAT_DIRECTORY)
     491                return EOK;
     492
     493        fibril_mutex_lock(&nodep->idx->lock);
     494
     495        rc = exfat_directory_open(nodep, &di);
     496        if (rc != EOK) {
     497                fibril_mutex_unlock(&nodep->idx->lock);
     498                return rc;
     499        }
     500
     501        do {
     502                rc = exfat_directory_get(&di, &d);
     503                if (rc != EOK) {
     504                        (void) exfat_directory_close(&di);
     505                        fibril_mutex_unlock(&nodep->idx->lock);
     506                        return rc;
     507                }
     508                switch (exfat_classify_dentry(d)) {
     509                case EXFAT_DENTRY_SKIP:
     510                case EXFAT_DENTRY_FREE:
     511                        continue;
     512                case EXFAT_DENTRY_LAST:
     513                        *has_children = false;
     514                        goto exit;
     515                default:
     516                        *has_children = true;
     517                        goto exit;
     518                }
     519        } while (exfat_directory_next(&di) == EOK);
     520
     521exit:
     522        rc = exfat_directory_close(&di);
     523        fibril_mutex_unlock(&nodep->idx->lock);
     524        return rc;
    485525}
    486526
Note: See TracChangeset for help on using the changeset viewer.