Subversion Repositories HelenOS

Rev

Rev 2710 | Rev 2728 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2710 Rev 2711
Line 120... Line 120...
120
    root->index = tmpfs_next_index++;
120
    root->index = tmpfs_next_index++;
121
    root->name = "";
121
    root->name = "";
122
    root->type = TMPFS_DIRECTORY;
122
    root->type = TMPFS_DIRECTORY;
123
    hash_table_insert(&dentries, &root->index, &root->dh_link);
123
    hash_table_insert(&dentries, &root->index, &root->dh_link);
124
 
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);
-
 
195
 
-
 
196
    return true;
125
    return true;
197
}
126
}
198
 
127
 
199
/** Compare one component of path to a directory entry.
128
/** Compare one component of path to a directory entry.
200
 *
129
 *