Changeset acfdcb0 in mainline for uspace/srv/fs/tmpfs/tmpfs_ops.c


Ignore:
Timestamp:
2008-01-27T19:11:40Z (17 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
43b1e86
Parents:
f7017572
Message:

Remove the debugging hack from tmpfs_init(), which created several files and
directories on the filesystem. TMPFS is now self-sufficient enough to be able
to create its content via the standard VFS interface.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/fs/tmpfs/tmpfs_ops.c

    rf7017572 racfdcb0  
    122122        root->type = TMPFS_DIRECTORY;
    123123        hash_table_insert(&dentries, &root->index, &root->dh_link);
    124 
    125         /*
    126          * This is only for debugging. Once we can create files and directories
    127          * using VFS, we can get rid of this.
    128          */
    129         tmpfs_dentry_t *d;
    130         d = (tmpfs_dentry_t *) malloc(sizeof(tmpfs_dentry_t));
    131         if (!d) {
    132                 free(root);
    133                 root = NULL;
    134                 return false;
    135         }
    136         tmpfs_dentry_initialize(d);
    137         d->index = tmpfs_next_index++;
    138         root->child = d;
    139         d->parent = root;
    140         d->type = TMPFS_DIRECTORY;
    141         d->name = "dir1";
    142         hash_table_insert(&dentries, &d->index, &d->dh_link);
    143 
    144         d = (tmpfs_dentry_t *) malloc(sizeof(tmpfs_dentry_t));
    145         if (!d) {
    146                 free(root->child);
    147                 free(root);
    148                 root = NULL;
    149                 return false;
    150         }
    151         tmpfs_dentry_initialize(d);
    152         d->index = tmpfs_next_index++;
    153         root->child->sibling = d;
    154         d->parent = root;
    155         d->type = TMPFS_DIRECTORY;
    156         d->name = "dir2";
    157         hash_table_insert(&dentries, &d->index, &d->dh_link);
    158        
    159         d = (tmpfs_dentry_t *) malloc(sizeof(tmpfs_dentry_t));
    160         if (!d) {
    161                 free(root->child->sibling);
    162                 free(root->child);
    163                 free(root);
    164                 root = NULL;
    165                 return false;
    166         }
    167         tmpfs_dentry_initialize(d);
    168         d->index = tmpfs_next_index++;
    169         root->child->child = d;
    170         d->parent = root->child;
    171         d->type = TMPFS_FILE;
    172         d->name = "file1";
    173         d->data = "This is the contents of /dir1/file1.\n";
    174         d->size = strlen(d->data);
    175         hash_table_insert(&dentries, &d->index, &d->dh_link);
    176 
    177         d = (tmpfs_dentry_t *) malloc(sizeof(tmpfs_dentry_t));
    178         if (!d) {
    179                 free(root->child->sibling);
    180                 free(root->child->child);
    181                 free(root->child);
    182                 free(root);
    183                 root = NULL;
    184                 return false;
    185         }
    186         tmpfs_dentry_initialize(d);
    187         d->index = tmpfs_next_index++;
    188         root->child->sibling->child = d;
    189         d->parent = root->child->sibling;
    190         d->type = TMPFS_FILE;
    191         d->name = "file2";
    192         d->data = "This is the contents of /dir2/file2.\n";
    193         d->size = strlen(d->data);
    194         hash_table_insert(&dentries, &d->index, &d->dh_link);
    195124
    196125        return true;
Note: See TracChangeset for help on using the changeset viewer.