Changeset e32b65a in mainline


Ignore:
Timestamp:
2008-12-16T17:18:29Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
699743c
Parents:
f0c9aff
Message:

Add the ability to grow a FAT directory.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/fat/fat_ops.c

    rf0c9aff re32b65a  
    390390        unsigned dps;
    391391        unsigned blocks;
     392        fat_cluster_t mcl, lcl;
     393        int rc;
    392394
    393395        futex_down(&childp->lock);
     
    442444         * We need to grow the parent in order to create a new unused dentry.
    443445         */
    444         futex_up(&parentp->idx->lock);
    445         return ENOTSUP; /* XXX */
     446        if (parentp->idx->pfc == FAT_CLST_ROOT) {
     447                /* Can't grow the root directory. */
     448                futex_up(&parentp->idx->lock);
     449                return ENOSPC;
     450        }
     451        rc = fat_alloc_clusters(bs, parentp->idx->dev_handle, 1, &mcl, &lcl);
     452        if (rc != EOK) {
     453                futex_up(&parentp->idx->lock);
     454                return rc;
     455        }
     456        fat_append_clusters(bs, parentp, mcl);
     457        b = fat_block_get(bs, parentp, i, BLOCK_FLAGS_NOREAD);
     458        d = (fat_dentry_t *)b->data;
     459        /*
     460         * Clear all dentries in the block except for the first one (the first
     461         * dentry will be cleared in the next step).
     462         */
     463        memset(d + 1, 0, bps - sizeof(fat_dentry_t));
    446464
    447465hit:
     
    449467         * At this point we only establish the link between the parent and the
    450468         * child.  The dentry, except of the name and the extension, will remain
    451          * uninitialized until the the corresponding node is synced. Thus the
    452          * valid dentry data is kept in the child node structure.
     469         * uninitialized until the corresponding node is synced. Thus the valid
     470         * dentry data is kept in the child node structure.
    453471         */
    454472        memset(d, 0, sizeof(fat_dentry_t));
Note: See TracChangeset for help on using the changeset viewer.