Subversion Repositories HelenOS

Rev

Rev 4581 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4581 Rev 4718
1
/*
1
/*
2
 * Copyright (c) 2008 Jakub Jermar
2
 * Copyright (c) 2008 Jakub Jermar
3
 * All rights reserved.
3
 * All rights reserved.
4
 *
4
 *
5
 * Redistribution and use in source and binary forms, with or without
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
6
 * modification, are permitted provided that the following conditions
7
 * are met:
7
 * are met:
8
 *
8
 *
9
 * - Redistributions of source code must retain the above copyright
9
 * - Redistributions of source code must retain the above copyright
10
 *   notice, this list of conditions and the following disclaimer.
10
 *   notice, this list of conditions and the following disclaimer.
11
 * - Redistributions in binary form must reproduce the above copyright
11
 * - Redistributions in binary form must reproduce the above copyright
12
 *   notice, this list of conditions and the following disclaimer in the
12
 *   notice, this list of conditions and the following disclaimer in the
13
 *   documentation and/or other materials provided with the distribution.
13
 *   documentation and/or other materials provided with the distribution.
14
 * - The name of the author may not be used to endorse or promote products
14
 * - The name of the author may not be used to endorse or promote products
15
 *   derived from this software without specific prior written permission.
15
 *   derived from this software without specific prior written permission.
16
 *
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
/** @addtogroup fs
29
/** @addtogroup fs
30
 * @{
30
 * @{
31
 */
31
 */
32
 
32
 
33
/**
33
/**
34
 * @file    tmpfs_ops.c
34
 * @file    tmpfs_ops.c
35
 * @brief   Implementation of VFS operations for the TMPFS file system
35
 * @brief   Implementation of VFS operations for the TMPFS file system
36
 *      server.
36
 *      server.
37
 */
37
 */
38
 
38
 
39
#include "tmpfs.h"
39
#include "tmpfs.h"
40
#include "../../vfs/vfs.h"
40
#include "../../vfs/vfs.h"
41
#include <ipc/ipc.h>
41
#include <ipc/ipc.h>
42
#include <async.h>
42
#include <async.h>
43
#include <errno.h>
43
#include <errno.h>
44
#include <atomic.h>
44
#include <atomic.h>
45
#include <stdlib.h>
45
#include <stdlib.h>
46
#include <string.h>
46
#include <string.h>
47
#include <stdio.h>
47
#include <stdio.h>
48
#include <assert.h>
48
#include <assert.h>
49
#include <sys/types.h>
49
#include <sys/types.h>
50
#include <adt/hash_table.h>
50
#include <adt/hash_table.h>
51
#include <as.h>
51
#include <as.h>
52
#include <libfs.h>
52
#include <libfs.h>
53
 
53
 
54
#define min(a, b)       ((a) < (b) ? (a) : (b))
54
#define min(a, b)       ((a) < (b) ? (a) : (b))
55
#define max(a, b)       ((a) > (b) ? (a) : (b))
55
#define max(a, b)       ((a) > (b) ? (a) : (b))
56
 
56
 
57
#define NODES_BUCKETS   256
57
#define NODES_BUCKETS   256
58
 
58
 
59
/** All root nodes have index 0. */
59
/** All root nodes have index 0. */
60
#define TMPFS_SOME_ROOT     0
60
#define TMPFS_SOME_ROOT     0
61
/** Global counter for assigning node indices. Shared by all instances. */
61
/** Global counter for assigning node indices. Shared by all instances. */
62
fs_index_t tmpfs_next_index = 1;
62
fs_index_t tmpfs_next_index = 1;
63
 
63
 
64
/*
64
/*
65
 * Implementation of the libfs interface.
65
 * Implementation of the libfs interface.
66
 */
66
 */
67
 
67
 
68
/* Forward declarations of static functions. */
68
/* Forward declarations of static functions. */
69
static fs_node_t *tmpfs_match(fs_node_t *, const char *);
69
static fs_node_t *tmpfs_match(fs_node_t *, const char *);
70
static fs_node_t *tmpfs_node_get(dev_handle_t, fs_index_t);
70
static fs_node_t *tmpfs_node_get(dev_handle_t, fs_index_t);
71
static void tmpfs_node_put(fs_node_t *);
71
static void tmpfs_node_put(fs_node_t *);
72
static fs_node_t *tmpfs_create_node(dev_handle_t, int);
72
static fs_node_t *tmpfs_create_node(dev_handle_t, int);
73
static int tmpfs_link_node(fs_node_t *, fs_node_t *, const char *);
73
static int tmpfs_link_node(fs_node_t *, fs_node_t *, const char *);
74
static int tmpfs_unlink_node(fs_node_t *, fs_node_t *, const char *);
74
static int tmpfs_unlink_node(fs_node_t *, fs_node_t *, const char *);
75
static int tmpfs_destroy_node(fs_node_t *);
75
static int tmpfs_destroy_node(fs_node_t *);
76
 
76
 
77
/* Implementation of helper functions. */
77
/* Implementation of helper functions. */
78
static fs_index_t tmpfs_index_get(fs_node_t *fn)
78
static fs_index_t tmpfs_index_get(fs_node_t *fn)
79
{
79
{
80
    return TMPFS_NODE(fn)->index;
80
    return TMPFS_NODE(fn)->index;
81
}
81
}
82
 
82
 
83
static size_t tmpfs_size_get(fs_node_t *fn)
83
static size_t tmpfs_size_get(fs_node_t *fn)
84
{
84
{
85
    return TMPFS_NODE(fn)->size;
85
    return TMPFS_NODE(fn)->size;
86
}
86
}
87
 
87
 
88
static unsigned tmpfs_lnkcnt_get(fs_node_t *fn)
88
static unsigned tmpfs_lnkcnt_get(fs_node_t *fn)
89
{
89
{
90
    return TMPFS_NODE(fn)->lnkcnt;
90
    return TMPFS_NODE(fn)->lnkcnt;
91
}
91
}
92
 
92
 
93
static bool tmpfs_has_children(fs_node_t *fn)
93
static bool tmpfs_has_children(fs_node_t *fn)
94
{
94
{
95
    return !list_empty(&TMPFS_NODE(fn)->cs_head);
95
    return !list_empty(&TMPFS_NODE(fn)->cs_head);
96
}
96
}
97
 
97
 
98
static fs_node_t *tmpfs_root_get(dev_handle_t dev_handle)
98
static fs_node_t *tmpfs_root_get(dev_handle_t dev_handle)
99
{
99
{
100
    return tmpfs_node_get(dev_handle, TMPFS_SOME_ROOT);
100
    return tmpfs_node_get(dev_handle, TMPFS_SOME_ROOT);
101
}
101
}
102
 
102
 
103
static char tmpfs_plb_get_char(unsigned pos)
103
static char tmpfs_plb_get_char(unsigned pos)
104
{
104
{
105
    return tmpfs_reg.plb_ro[pos % PLB_SIZE];
105
    return tmpfs_reg.plb_ro[pos % PLB_SIZE];
106
}
106
}
107
 
107
 
108
static bool tmpfs_is_directory(fs_node_t *fn)
108
static bool tmpfs_is_directory(fs_node_t *fn)
109
{
109
{
110
    return TMPFS_NODE(fn)->type == TMPFS_DIRECTORY;
110
    return TMPFS_NODE(fn)->type == TMPFS_DIRECTORY;
111
}
111
}
112
 
112
 
113
static bool tmpfs_is_file(fs_node_t *fn)
113
static bool tmpfs_is_file(fs_node_t *fn)
114
{
114
{
115
    return TMPFS_NODE(fn)->type == TMPFS_FILE;
115
    return TMPFS_NODE(fn)->type == TMPFS_FILE;
116
}
116
}
117
 
117
 
118
/** libfs operations */
118
/** libfs operations */
119
libfs_ops_t tmpfs_libfs_ops = {
119
libfs_ops_t tmpfs_libfs_ops = {
120
    .match = tmpfs_match,
120
    .match = tmpfs_match,
121
    .node_get = tmpfs_node_get,
121
    .node_get = tmpfs_node_get,
122
    .node_put = tmpfs_node_put,
122
    .node_put = tmpfs_node_put,
123
    .create = tmpfs_create_node,
123
    .create = tmpfs_create_node,
124
    .destroy = tmpfs_destroy_node,
124
    .destroy = tmpfs_destroy_node,
125
    .link = tmpfs_link_node,
125
    .link = tmpfs_link_node,
126
    .unlink = tmpfs_unlink_node,
126
    .unlink = tmpfs_unlink_node,
127
    .index_get = tmpfs_index_get,
127
    .index_get = tmpfs_index_get,
128
    .size_get = tmpfs_size_get,
128
    .size_get = tmpfs_size_get,
129
    .lnkcnt_get = tmpfs_lnkcnt_get,
129
    .lnkcnt_get = tmpfs_lnkcnt_get,
130
    .has_children = tmpfs_has_children,
130
    .has_children = tmpfs_has_children,
131
    .root_get = tmpfs_root_get,
131
    .root_get = tmpfs_root_get,
132
    .plb_get_char = tmpfs_plb_get_char,
132
    .plb_get_char = tmpfs_plb_get_char,
133
    .is_directory = tmpfs_is_directory,
133
    .is_directory = tmpfs_is_directory,
134
    .is_file = tmpfs_is_file
134
    .is_file = tmpfs_is_file
135
};
135
};
136
 
136
 
137
/** Hash table of all TMPFS nodes. */
137
/** Hash table of all TMPFS nodes. */
138
hash_table_t nodes;
138
hash_table_t nodes;
139
 
139
 
140
#define NODES_KEY_INDEX 0
140
#define NODES_KEY_INDEX 0
141
#define NODES_KEY_DEV   1
141
#define NODES_KEY_DEV   1
142
 
142
 
143
/* Implementation of hash table interface for the nodes hash table. */
143
/* Implementation of hash table interface for the nodes hash table. */
144
static hash_index_t nodes_hash(unsigned long key[])
144
static hash_index_t nodes_hash(unsigned long key[])
145
{
145
{
146
    return key[NODES_KEY_INDEX] % NODES_BUCKETS;
146
    return key[NODES_KEY_INDEX] % NODES_BUCKETS;
147
}
147
}
148
 
148
 
149
static int nodes_compare(unsigned long key[], hash_count_t keys, link_t *item)
149
static int nodes_compare(unsigned long key[], hash_count_t keys, link_t *item)
150
{
150
{
151
    tmpfs_node_t *nodep = hash_table_get_instance(item, tmpfs_node_t,
151
    tmpfs_node_t *nodep = hash_table_get_instance(item, tmpfs_node_t,
152
        nh_link);
152
        nh_link);
153
    return (nodep->index == key[NODES_KEY_INDEX] &&
153
    return (nodep->index == key[NODES_KEY_INDEX] &&
154
        nodep->dev_handle == key[NODES_KEY_DEV]);
154
        nodep->dev_handle == key[NODES_KEY_DEV]);
155
}
155
}
156
 
156
 
157
static void nodes_remove_callback(link_t *item)
157
static void nodes_remove_callback(link_t *item)
158
{
158
{
159
}
159
}
160
 
160
 
161
/** TMPFS nodes hash table operations. */
161
/** TMPFS nodes hash table operations. */
162
hash_table_operations_t nodes_ops = {
162
hash_table_operations_t nodes_ops = {
163
    .hash = nodes_hash,
163
    .hash = nodes_hash,
164
    .compare = nodes_compare,
164
    .compare = nodes_compare,
165
    .remove_callback = nodes_remove_callback
165
    .remove_callback = nodes_remove_callback
166
};
166
};
167
 
167
 
168
static void tmpfs_node_initialize(tmpfs_node_t *nodep)
168
static void tmpfs_node_initialize(tmpfs_node_t *nodep)
169
{
169
{
170
    nodep->bp = NULL;
170
    nodep->bp = NULL;
171
    nodep->index = 0;
171
    nodep->index = 0;
172
    nodep->dev_handle = 0;
172
    nodep->dev_handle = 0;
173
    nodep->type = TMPFS_NONE;
173
    nodep->type = TMPFS_NONE;
174
    nodep->lnkcnt = 0;
174
    nodep->lnkcnt = 0;
175
    nodep->size = 0;
175
    nodep->size = 0;
176
    nodep->data = NULL;
176
    nodep->data = NULL;
177
    link_initialize(&nodep->nh_link);
177
    link_initialize(&nodep->nh_link);
178
    list_initialize(&nodep->cs_head);
178
    list_initialize(&nodep->cs_head);
179
}
179
}
180
 
180
 
181
static void tmpfs_dentry_initialize(tmpfs_dentry_t *dentryp)
181
static void tmpfs_dentry_initialize(tmpfs_dentry_t *dentryp)
182
{
182
{
183
    link_initialize(&dentryp->link);
183
    link_initialize(&dentryp->link);
184
    dentryp->name = NULL;
184
    dentryp->name = NULL;
185
    dentryp->node = NULL;
185
    dentryp->node = NULL;
186
}
186
}
187
 
187
 
188
bool tmpfs_init(void)
188
bool tmpfs_init(void)
189
{
189
{
190
    if (!hash_table_create(&nodes, NODES_BUCKETS, 2, &nodes_ops))
190
    if (!hash_table_create(&nodes, NODES_BUCKETS, 2, &nodes_ops))
191
        return false;
191
        return false;
192
   
192
   
193
    return true;
193
    return true;
194
}
194
}
195
 
195
 
196
static bool tmpfs_instance_init(dev_handle_t dev_handle)
196
static bool tmpfs_instance_init(dev_handle_t dev_handle)
197
{
197
{
198
    fs_node_t *rfn;
198
    fs_node_t *rfn;
199
   
199
   
200
    rfn = tmpfs_create_node(dev_handle, L_DIRECTORY);
200
    rfn = tmpfs_create_node(dev_handle, L_DIRECTORY);
201
    if (!rfn)
201
    if (!rfn)
202
        return false;
202
        return false;
203
    TMPFS_NODE(rfn)->lnkcnt = 0;    /* FS root is not linked */
203
    TMPFS_NODE(rfn)->lnkcnt = 0;    /* FS root is not linked */
204
    return true;
204
    return true;
205
}
205
}
206
 
206
 
207
fs_node_t *tmpfs_match(fs_node_t *pfn, const char *component)
207
fs_node_t *tmpfs_match(fs_node_t *pfn, const char *component)
208
{
208
{
209
    tmpfs_node_t *parentp = TMPFS_NODE(pfn);
209
    tmpfs_node_t *parentp = TMPFS_NODE(pfn);
210
    link_t *lnk;
210
    link_t *lnk;
211
 
211
 
212
    for (lnk = parentp->cs_head.next; lnk != &parentp->cs_head;
212
    for (lnk = parentp->cs_head.next; lnk != &parentp->cs_head;
213
        lnk = lnk->next) {
213
        lnk = lnk->next) {
214
        tmpfs_dentry_t *dentryp = list_get_instance(lnk, tmpfs_dentry_t,
214
        tmpfs_dentry_t *dentryp = list_get_instance(lnk, tmpfs_dentry_t,
215
            link);
215
            link);
216
        if (!str_cmp(dentryp->name, component))
216
        if (!str_cmp(dentryp->name, component))
217
            return FS_NODE(dentryp->node);
217
            return FS_NODE(dentryp->node);
218
    }
218
    }
219
 
219
 
220
    return NULL;
220
    return NULL;
221
}
221
}
222
 
222
 
223
fs_node_t *tmpfs_node_get(dev_handle_t dev_handle, fs_index_t index)
223
fs_node_t *tmpfs_node_get(dev_handle_t dev_handle, fs_index_t index)
224
{
224
{
225
    unsigned long key[] = {
225
    unsigned long key[] = {
226
        [NODES_KEY_INDEX] = index,
226
        [NODES_KEY_INDEX] = index,
227
        [NODES_KEY_DEV] = dev_handle
227
        [NODES_KEY_DEV] = dev_handle
228
    };
228
    };
229
    link_t *lnk = hash_table_find(&nodes, key);
229
    link_t *lnk = hash_table_find(&nodes, key);
230
    if (!lnk)
230
    if (!lnk)
231
        return NULL;
231
        return NULL;
232
    return FS_NODE(hash_table_get_instance(lnk, tmpfs_node_t, nh_link));
232
    return FS_NODE(hash_table_get_instance(lnk, tmpfs_node_t, nh_link));
233
}
233
}
234
 
234
 
235
void tmpfs_node_put(fs_node_t *fn)
235
void tmpfs_node_put(fs_node_t *fn)
236
{
236
{
237
    /* nothing to do */
237
    /* nothing to do */
238
}
238
}
239
 
239
 
240
fs_node_t *tmpfs_create_node(dev_handle_t dev_handle, int lflag)
240
fs_node_t *tmpfs_create_node(dev_handle_t dev_handle, int lflag)
241
{
241
{
242
    assert((lflag & L_FILE) ^ (lflag & L_DIRECTORY));
242
    assert((lflag & L_FILE) ^ (lflag & L_DIRECTORY));
243
 
243
 
244
    tmpfs_node_t *nodep = malloc(sizeof(tmpfs_node_t));
244
    tmpfs_node_t *nodep = malloc(sizeof(tmpfs_node_t));
245
    if (!nodep)
245
    if (!nodep)
246
        return NULL;
246
        return NULL;
247
    tmpfs_node_initialize(nodep);
247
    tmpfs_node_initialize(nodep);
248
    nodep->bp = malloc(sizeof(fs_node_t));
248
    nodep->bp = malloc(sizeof(fs_node_t));
249
    if (!nodep->bp) {
249
    if (!nodep->bp) {
250
        free(nodep);
250
        free(nodep);
251
        return NULL;
251
        return NULL;
252
    }
252
    }
253
    fs_node_initialize(nodep->bp);
253
    fs_node_initialize(nodep->bp);
254
    nodep->bp->data = nodep;    /* link the FS and TMPFS nodes */
254
    nodep->bp->data = nodep;    /* link the FS and TMPFS nodes */
255
    if (!tmpfs_root_get(dev_handle))
255
    if (!tmpfs_root_get(dev_handle))
256
        nodep->index = TMPFS_SOME_ROOT;
256
        nodep->index = TMPFS_SOME_ROOT;
257
    else
257
    else
258
        nodep->index = tmpfs_next_index++;
258
        nodep->index = tmpfs_next_index++;
259
    nodep->dev_handle = dev_handle;
259
    nodep->dev_handle = dev_handle;
260
    if (lflag & L_DIRECTORY)
260
    if (lflag & L_DIRECTORY)
261
        nodep->type = TMPFS_DIRECTORY;
261
        nodep->type = TMPFS_DIRECTORY;
262
    else
262
    else
263
        nodep->type = TMPFS_FILE;
263
        nodep->type = TMPFS_FILE;
264
 
264
 
265
    /* Insert the new node into the nodes hash table. */
265
    /* Insert the new node into the nodes hash table. */
266
    unsigned long key[] = {
266
    unsigned long key[] = {
267
        [NODES_KEY_INDEX] = nodep->index,
267
        [NODES_KEY_INDEX] = nodep->index,
268
        [NODES_KEY_DEV] = nodep->dev_handle
268
        [NODES_KEY_DEV] = nodep->dev_handle
269
    };
269
    };
270
    hash_table_insert(&nodes, key, &nodep->nh_link);
270
    hash_table_insert(&nodes, key, &nodep->nh_link);
271
    return FS_NODE(nodep);
271
    return FS_NODE(nodep);
272
}
272
}
273
 
273
 
274
int tmpfs_link_node(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
274
int tmpfs_link_node(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
275
{
275
{
276
    tmpfs_node_t *parentp = TMPFS_NODE(pfn);
276
    tmpfs_node_t *parentp = TMPFS_NODE(pfn);
277
    tmpfs_node_t *childp = TMPFS_NODE(cfn);
277
    tmpfs_node_t *childp = TMPFS_NODE(cfn);
278
    tmpfs_dentry_t *dentryp;
278
    tmpfs_dentry_t *dentryp;
279
    link_t *lnk;
279
    link_t *lnk;
280
 
280
 
281
    assert(parentp->type == TMPFS_DIRECTORY);
281
    assert(parentp->type == TMPFS_DIRECTORY);
282
 
282
 
283
    /* Check for duplicit entries. */
283
    /* Check for duplicit entries. */
284
    for (lnk = parentp->cs_head.next; lnk != &parentp->cs_head;
284
    for (lnk = parentp->cs_head.next; lnk != &parentp->cs_head;
285
        lnk = lnk->next) {
285
        lnk = lnk->next) {
286
        dentryp = list_get_instance(lnk, tmpfs_dentry_t, link);
286
        dentryp = list_get_instance(lnk, tmpfs_dentry_t, link);
287
        if (!str_cmp(dentryp->name, nm))
287
        if (!str_cmp(dentryp->name, nm))
288
            return EEXIST;
288
            return EEXIST;
289
    }
289
    }
290
 
290
 
291
    /* Allocate and initialize the dentry. */
291
    /* Allocate and initialize the dentry. */
292
    dentryp = malloc(sizeof(tmpfs_dentry_t));
292
    dentryp = malloc(sizeof(tmpfs_dentry_t));
293
    if (!dentryp)
293
    if (!dentryp)
294
        return ENOMEM;
294
        return ENOMEM;
295
    tmpfs_dentry_initialize(dentryp);
295
    tmpfs_dentry_initialize(dentryp);
296
 
296
 
297
    /* Populate and link the new dentry. */
297
    /* Populate and link the new dentry. */
298
    size_t size = str_size(nm);
298
    size_t size = str_size(nm);
299
    dentryp->name = malloc(size + 1);
299
    dentryp->name = malloc(size + 1);
300
    if (!dentryp->name) {
300
    if (!dentryp->name) {
301
        free(dentryp);
301
        free(dentryp);
302
        return ENOMEM;
302
        return ENOMEM;
303
    }
303
    }
304
    str_cpy(dentryp->name, size + 1, nm);
304
    str_cpy(dentryp->name, size + 1, nm);
305
    dentryp->node = childp;
305
    dentryp->node = childp;
306
    childp->lnkcnt++;
306
    childp->lnkcnt++;
307
    list_append(&dentryp->link, &parentp->cs_head);
307
    list_append(&dentryp->link, &parentp->cs_head);
308
 
308
 
309
    return EOK;
309
    return EOK;
310
}
310
}
311
 
311
 
312
int tmpfs_unlink_node(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
312
int tmpfs_unlink_node(fs_node_t *pfn, fs_node_t *cfn, const char *nm)
313
{
313
{
314
    tmpfs_node_t *parentp = TMPFS_NODE(pfn);
314
    tmpfs_node_t *parentp = TMPFS_NODE(pfn);
315
    tmpfs_node_t *childp = NULL;
315
    tmpfs_node_t *childp = NULL;
316
    tmpfs_dentry_t *dentryp;
316
    tmpfs_dentry_t *dentryp;
317
    link_t *lnk;
317
    link_t *lnk;
318
 
318
 
319
    if (!parentp)
319
    if (!parentp)
320
        return EBUSY;
320
        return EBUSY;
321
   
321
   
322
    for (lnk = parentp->cs_head.next; lnk != &parentp->cs_head;
322
    for (lnk = parentp->cs_head.next; lnk != &parentp->cs_head;
323
        lnk = lnk->next) {
323
        lnk = lnk->next) {
324
        dentryp = list_get_instance(lnk, tmpfs_dentry_t, link);
324
        dentryp = list_get_instance(lnk, tmpfs_dentry_t, link);
325
        if (!str_cmp(dentryp->name, nm)) {
325
        if (!str_cmp(dentryp->name, nm)) {
326
            childp = dentryp->node;
326
            childp = dentryp->node;
327
            assert(FS_NODE(childp) == cfn);
327
            assert(FS_NODE(childp) == cfn);
328
            break;
328
            break;
329
        }  
329
        }  
330
    }
330
    }
331
 
331
 
332
    if (!childp)
332
    if (!childp)
333
        return ENOENT;
333
        return ENOENT;
334
       
334
       
335
    if ((childp->lnkcnt == 1) && !list_empty(&childp->cs_head))
335
    if ((childp->lnkcnt == 1) && !list_empty(&childp->cs_head))
336
        return ENOTEMPTY;
336
        return ENOTEMPTY;
337
 
337
 
338
    list_remove(&dentryp->link);
338
    list_remove(&dentryp->link);
339
    free(dentryp);
339
    free(dentryp);
340
    childp->lnkcnt--;
340
    childp->lnkcnt--;
341
 
341
 
342
    return EOK;
342
    return EOK;
343
}
343
}
344
 
344
 
345
int tmpfs_destroy_node(fs_node_t *fn)
345
int tmpfs_destroy_node(fs_node_t *fn)
346
{
346
{
347
    tmpfs_node_t *nodep = TMPFS_NODE(fn);
347
    tmpfs_node_t *nodep = TMPFS_NODE(fn);
348
   
348
   
349
    assert(!nodep->lnkcnt);
349
    assert(!nodep->lnkcnt);
350
    assert(list_empty(&nodep->cs_head));
350
    assert(list_empty(&nodep->cs_head));
351
 
351
 
352
    unsigned long key[] = {
352
    unsigned long key[] = {
353
        [NODES_KEY_INDEX] = nodep->index,
353
        [NODES_KEY_INDEX] = nodep->index,
354
        [NODES_KEY_DEV] = nodep->dev_handle
354
        [NODES_KEY_DEV] = nodep->dev_handle
355
    };
355
    };
356
    hash_table_remove(&nodes, key, 2);
356
    hash_table_remove(&nodes, key, 2);
357
 
357
 
358
    if (nodep->type == TMPFS_FILE)
358
    if (nodep->type == TMPFS_FILE)
359
        free(nodep->data);
359
        free(nodep->data);
360
    free(nodep->bp);
360
    free(nodep->bp);
361
    free(nodep);
361
    free(nodep);
362
    return EOK;
362
    return EOK;
363
}
363
}
364
 
364
 
365
void tmpfs_mounted(ipc_callid_t rid, ipc_call_t *request)
365
void tmpfs_mounted(ipc_callid_t rid, ipc_call_t *request)
366
{
366
{
367
    dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
367
    dev_handle_t dev_handle = (dev_handle_t) IPC_GET_ARG1(*request);
368
 
368
 
369
    /* accept the mount options */
369
    /* accept the mount options */
370
    ipc_callid_t callid;
370
    ipc_callid_t callid;
371
    size_t size;
371
    size_t size;
372
    if (!ipc_data_write_receive(&callid, &size)) {
372
    if (!ipc_data_write_receive(&callid, &size)) {
373
        ipc_answer_0(callid, EINVAL);
373
        ipc_answer_0(callid, EINVAL);
374
        ipc_answer_0(rid, EINVAL);
374
        ipc_answer_0(rid, EINVAL);
375
        return;
375
        return;
376
    }
376
    }
377
    char *opts = malloc(size + 1);
377
    char *opts = malloc(size + 1);
378
    if (!opts) {
378
    if (!opts) {
379
        ipc_answer_0(callid, ENOMEM);
379
        ipc_answer_0(callid, ENOMEM);
380
        ipc_answer_0(rid, ENOMEM);
380
        ipc_answer_0(rid, ENOMEM);
381
        return;
381
        return;
382
    }
382
    }
383
    ipcarg_t retval = ipc_data_write_finalize(callid, opts, size);
383
    ipcarg_t retval = ipc_data_write_finalize(callid, opts, size);
384
    if (retval != EOK) {
384
    if (retval != EOK) {
385
        ipc_answer_0(rid, retval);
385
        ipc_answer_0(rid, retval);
386
        free(opts);
386
        free(opts);
387
        return;
387
        return;
388
    }
388
    }
389
    opts[size] = '\0';
389
    opts[size] = '\0';
390
 
390
 
391
    /* Initialize TMPFS instance. */
391
    /* Initialize TMPFS instance. */
392
    if (!tmpfs_instance_init(dev_handle)) {
392
    if (!tmpfs_instance_init(dev_handle)) {
393
        ipc_answer_0(rid, ENOMEM);
393
        ipc_answer_0(rid, ENOMEM);
394
        return;
394
        return;
395
    }
395
    }
396
 
396
 
397
    tmpfs_node_t *rootp = TMPFS_NODE(tmpfs_root_get(dev_handle));
397
    tmpfs_node_t *rootp = TMPFS_NODE(tmpfs_root_get(dev_handle));
398
    if (str_cmp(opts, "restore") == 0) {
398
    if (str_cmp(opts, "restore") == 0) {
399
        if (tmpfs_restore(dev_handle))
399
        if (tmpfs_restore(dev_handle))
400
            ipc_answer_3(rid, EOK, rootp->index, rootp->size,
400
            ipc_answer_3(rid, EOK, rootp->index, rootp->size,
401
                rootp->lnkcnt);
401
                rootp->lnkcnt);
402
        else
402
        else
403
            ipc_answer_0(rid, ELIMIT);
403
            ipc_answer_0(rid, ELIMIT);
404
    } else {
404
    } else {
405
        ipc_answer_3(rid, EOK, rootp->index, rootp->size,
405
        ipc_answer_3(rid, EOK, rootp->index, rootp->size,
406
            rootp->lnkcnt);
406
            rootp->lnkcnt);
407
    }
407
    }
408
}
408
}
409
 
409
 
410
void tmpfs_mount(ipc_callid_t rid, ipc_call_t *request)
410
void tmpfs_mount(ipc_callid_t rid, ipc_call_t *request)
411
{
411
{
412
    libfs_mount(&tmpfs_libfs_ops, tmpfs_reg.fs_handle, rid, request);
412
    libfs_mount(&tmpfs_libfs_ops, tmpfs_reg.fs_handle, rid, request);
413
}
413
}
414
 
414
 
415
void tmpfs_lookup(ipc_callid_t rid, ipc_call_t *request)
415
void tmpfs_lookup(ipc_callid_t rid, ipc_call_t *request)
416
{
416
{
417
    libfs_lookup(&tmpfs_libfs_ops, tmpfs_reg.fs_handle, rid, request);
417
    libfs_lookup(&tmpfs_libfs_ops, tmpfs_reg.fs_handle, rid, request);
418
}
418
}
419
 
419
 
420
void tmpfs_read(ipc_callid_t rid, ipc_call_t *request)
420
void tmpfs_read(ipc_callid_t rid, ipc_call_t *request)
421
{
421
{
422
    dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
422
    dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
423
    fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
423
    fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
424
    off_t pos = (off_t)IPC_GET_ARG3(*request);
424
    off_t pos = (off_t)IPC_GET_ARG3(*request);
425
 
425
 
426
    /*
426
    /*
427
     * Lookup the respective TMPFS node.
427
     * Lookup the respective TMPFS node.
428
     */
428
     */
429
    link_t *hlp;
429
    link_t *hlp;
430
    unsigned long key[] = {
430
    unsigned long key[] = {
431
        [NODES_KEY_INDEX] = index,
431
        [NODES_KEY_INDEX] = index,
432
        [NODES_KEY_DEV] = dev_handle,
432
        [NODES_KEY_DEV] = dev_handle,
433
    };
433
    };
434
    hlp = hash_table_find(&nodes, key);
434
    hlp = hash_table_find(&nodes, key);
435
    if (!hlp) {
435
    if (!hlp) {
436
        ipc_answer_0(rid, ENOENT);
436
        ipc_answer_0(rid, ENOENT);
437
        return;
437
        return;
438
    }
438
    }
439
    tmpfs_node_t *nodep = hash_table_get_instance(hlp, tmpfs_node_t,
439
    tmpfs_node_t *nodep = hash_table_get_instance(hlp, tmpfs_node_t,
440
        nh_link);
440
        nh_link);
441
 
441
 
442
    /*
442
    /*
443
     * Receive the read request.
443
     * Receive the read request.
444
     */
444
     */
445
    ipc_callid_t callid;
445
    ipc_callid_t callid;
446
    size_t size;
446
    size_t size;
447
    if (!ipc_data_read_receive(&callid, &size)) {
447
    if (!ipc_data_read_receive(&callid, &size)) {
448
        ipc_answer_0(callid, EINVAL);  
448
        ipc_answer_0(callid, EINVAL);  
449
        ipc_answer_0(rid, EINVAL);
449
        ipc_answer_0(rid, EINVAL);
450
        return;
450
        return;
451
    }
451
    }
452
 
452
 
453
    size_t bytes;
453
    size_t bytes;
454
    if (nodep->type == TMPFS_FILE) {
454
    if (nodep->type == TMPFS_FILE) {
455
        bytes = max(0, min(nodep->size - pos, size));
455
        bytes = max(0, min(nodep->size - pos, size));
456
        (void) ipc_data_read_finalize(callid, nodep->data + pos,
456
        (void) ipc_data_read_finalize(callid, nodep->data + pos,
457
            bytes);
457
            bytes);
458
    } else {
458
    } else {
459
        tmpfs_dentry_t *dentryp;
459
        tmpfs_dentry_t *dentryp;
460
        link_t *lnk;
460
        link_t *lnk;
461
        int i;
461
        int i;
462
       
462
       
463
        assert(nodep->type == TMPFS_DIRECTORY);
463
        assert(nodep->type == TMPFS_DIRECTORY);
464
       
464
       
465
        /*
465
        /*
466
         * Yes, we really use O(n) algorithm here.
466
         * Yes, we really use O(n) algorithm here.
467
         * If it bothers someone, it could be fixed by introducing a
467
         * If it bothers someone, it could be fixed by introducing a
468
         * hash table.
468
         * hash table.
469
         */
469
         */
470
        for (i = 0, lnk = nodep->cs_head.next;
470
        for (i = 0, lnk = nodep->cs_head.next;
471
            i < pos && lnk != &nodep->cs_head;
471
            i < pos && lnk != &nodep->cs_head;
472
            i++, lnk = lnk->next)
472
            i++, lnk = lnk->next)
473
            ;
473
            ;
474
 
474
 
475
        if (lnk == &nodep->cs_head) {
475
        if (lnk == &nodep->cs_head) {
476
            ipc_answer_0(callid, ENOENT);
476
            ipc_answer_0(callid, ENOENT);
477
            ipc_answer_1(rid, ENOENT, 0);
477
            ipc_answer_1(rid, ENOENT, 0);
478
            return;
478
            return;
479
        }
479
        }
480
 
480
 
481
        dentryp = list_get_instance(lnk, tmpfs_dentry_t, link);
481
        dentryp = list_get_instance(lnk, tmpfs_dentry_t, link);
482
 
482
 
483
        (void) ipc_data_read_finalize(callid, dentryp->name,
483
        (void) ipc_data_read_finalize(callid, dentryp->name,
484
            str_size(dentryp->name) + 1);
484
            str_size(dentryp->name) + 1);
485
        bytes = 1;
485
        bytes = 1;
486
    }
486
    }
487
 
487
 
488
    /*
488
    /*
489
     * Answer the VFS_READ call.
489
     * Answer the VFS_READ call.
490
     */
490
     */
491
    ipc_answer_1(rid, EOK, bytes);
491
    ipc_answer_1(rid, EOK, bytes);
492
}
492
}
493
 
493
 
494
void tmpfs_write(ipc_callid_t rid, ipc_call_t *request)
494
void tmpfs_write(ipc_callid_t rid, ipc_call_t *request)
495
{
495
{
496
    dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
496
    dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
497
    fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
497
    fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
498
    off_t pos = (off_t)IPC_GET_ARG3(*request);
498
    off_t pos = (off_t)IPC_GET_ARG3(*request);
499
 
499
 
500
    /*
500
    /*
501
     * Lookup the respective TMPFS node.
501
     * Lookup the respective TMPFS node.
502
     */
502
     */
503
    link_t *hlp;
503
    link_t *hlp;
504
    unsigned long key[] = {
504
    unsigned long key[] = {
505
        [NODES_KEY_INDEX] = index,
505
        [NODES_KEY_INDEX] = index,
506
        [NODES_KEY_DEV] = dev_handle
506
        [NODES_KEY_DEV] = dev_handle
507
    };
507
    };
508
    hlp = hash_table_find(&nodes, key);
508
    hlp = hash_table_find(&nodes, key);
509
    if (!hlp) {
509
    if (!hlp) {
510
        ipc_answer_0(rid, ENOENT);
510
        ipc_answer_0(rid, ENOENT);
511
        return;
511
        return;
512
    }
512
    }
513
    tmpfs_node_t *nodep = hash_table_get_instance(hlp, tmpfs_node_t,
513
    tmpfs_node_t *nodep = hash_table_get_instance(hlp, tmpfs_node_t,
514
        nh_link);
514
        nh_link);
515
 
515
 
516
    /*
516
    /*
517
     * Receive the write request.
517
     * Receive the write request.
518
     */
518
     */
519
    ipc_callid_t callid;
519
    ipc_callid_t callid;
520
    size_t size;
520
    size_t size;
521
    if (!ipc_data_write_receive(&callid, &size)) {
521
    if (!ipc_data_write_receive(&callid, &size)) {
522
        ipc_answer_0(callid, EINVAL);  
522
        ipc_answer_0(callid, EINVAL);  
523
        ipc_answer_0(rid, EINVAL);
523
        ipc_answer_0(rid, EINVAL);
524
        return;
524
        return;
525
    }
525
    }
526
 
526
 
527
    /*
527
    /*
528
     * Check whether the file needs to grow.
528
     * Check whether the file needs to grow.
529
     */
529
     */
530
    if (pos + size <= nodep->size) {
530
    if (pos + size <= nodep->size) {
531
        /* The file size is not changing. */
531
        /* The file size is not changing. */
532
        (void) ipc_data_write_finalize(callid, nodep->data + pos, size);
532
        (void) ipc_data_write_finalize(callid, nodep->data + pos, size);
533
        ipc_answer_2(rid, EOK, size, nodep->size);
533
        ipc_answer_2(rid, EOK, size, nodep->size);
534
        return;
534
        return;
535
    }
535
    }
536
    size_t delta = (pos + size) - nodep->size;
536
    size_t delta = (pos + size) - nodep->size;
537
    /*
537
    /*
538
     * At this point, we are deliberately extremely straightforward and
538
     * At this point, we are deliberately extremely straightforward and
539
     * simply realloc the contents of the file on every write that grows the
539
     * simply realloc the contents of the file on every write that grows the
540
     * file. In the end, the situation might not be as bad as it may look:
540
     * file. In the end, the situation might not be as bad as it may look:
541
     * our heap allocator can save us and just grow the block whenever
541
     * our heap allocator can save us and just grow the block whenever
542
     * possible.
542
     * possible.
543
     */
543
     */
544
    void *newdata = realloc(nodep->data, nodep->size + delta);
544
    void *newdata = realloc(nodep->data, nodep->size + delta);
545
    if (!newdata) {
545
    if (!newdata) {
546
        ipc_answer_0(callid, ENOMEM);
546
        ipc_answer_0(callid, ENOMEM);
547
        ipc_answer_2(rid, EOK, 0, nodep->size);
547
        ipc_answer_2(rid, EOK, 0, nodep->size);
548
        return;
548
        return;
549
    }
549
    }
550
    /* Clear any newly allocated memory in order to emulate gaps. */
550
    /* Clear any newly allocated memory in order to emulate gaps. */
551
    memset(newdata + nodep->size, 0, delta);
551
    memset(newdata + nodep->size, 0, delta);
552
    nodep->size += delta;
552
    nodep->size += delta;
553
    nodep->data = newdata;
553
    nodep->data = newdata;
554
    (void) ipc_data_write_finalize(callid, nodep->data + pos, size);
554
    (void) ipc_data_write_finalize(callid, nodep->data + pos, size);
555
    ipc_answer_2(rid, EOK, size, nodep->size);
555
    ipc_answer_2(rid, EOK, size, nodep->size);
556
}
556
}
557
 
557
 
558
void tmpfs_truncate(ipc_callid_t rid, ipc_call_t *request)
558
void tmpfs_truncate(ipc_callid_t rid, ipc_call_t *request)
559
{
559
{
560
    dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
560
    dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
561
    fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
561
    fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
562
    size_t size = (off_t)IPC_GET_ARG3(*request);
562
    size_t size = (off_t)IPC_GET_ARG3(*request);
563
 
563
 
564
    /*
564
    /*
565
     * Lookup the respective TMPFS node.
565
     * Lookup the respective TMPFS node.
566
     */
566
     */
567
    link_t *hlp;
567
    link_t *hlp;
568
    unsigned long key[] = {
568
    unsigned long key[] = {
569
        [NODES_KEY_INDEX] = index,
569
        [NODES_KEY_INDEX] = index,
570
        [NODES_KEY_DEV] = dev_handle
570
        [NODES_KEY_DEV] = dev_handle
571
    };
571
    };
572
    hlp = hash_table_find(&nodes, key);
572
    hlp = hash_table_find(&nodes, key);
573
    if (!hlp) {
573
    if (!hlp) {
574
        ipc_answer_0(rid, ENOENT);
574
        ipc_answer_0(rid, ENOENT);
575
        return;
575
        return;
576
    }
576
    }
577
    tmpfs_node_t *nodep = hash_table_get_instance(hlp, tmpfs_node_t,
577
    tmpfs_node_t *nodep = hash_table_get_instance(hlp, tmpfs_node_t,
578
        nh_link);
578
        nh_link);
579
 
579
 
580
    if (size == nodep->size) {
580
    if (size == nodep->size) {
581
        ipc_answer_0(rid, EOK);
581
        ipc_answer_0(rid, EOK);
582
        return;
582
        return;
583
    }
583
    }
584
 
584
 
585
    void *newdata = realloc(nodep->data, size);
585
    void *newdata = realloc(nodep->data, size);
586
    if (!newdata) {
586
    if (!newdata) {
587
        ipc_answer_0(rid, ENOMEM);
587
        ipc_answer_0(rid, ENOMEM);
588
        return;
588
        return;
589
    }
589
    }
590
    if (size > nodep->size) {
590
    if (size > nodep->size) {
591
        size_t delta = size - nodep->size;
591
        size_t delta = size - nodep->size;
592
        memset(newdata + nodep->size, 0, delta);
592
        memset(newdata + nodep->size, 0, delta);
593
    }
593
    }
594
    nodep->size = size;
594
    nodep->size = size;
595
    nodep->data = newdata;
595
    nodep->data = newdata;
596
    ipc_answer_0(rid, EOK);
596
    ipc_answer_0(rid, EOK);
597
}
597
}
598
 
598
 
599
void tmpfs_close(ipc_callid_t rid, ipc_call_t *request)
599
void tmpfs_close(ipc_callid_t rid, ipc_call_t *request)
600
{
600
{
601
    ipc_answer_0(rid, EOK);
601
    ipc_answer_0(rid, EOK);
602
}
602
}
603
 
603
 
604
void tmpfs_destroy(ipc_callid_t rid, ipc_call_t *request)
604
void tmpfs_destroy(ipc_callid_t rid, ipc_call_t *request)
605
{
605
{
606
    dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
606
    dev_handle_t dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
607
    fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
607
    fs_index_t index = (fs_index_t)IPC_GET_ARG2(*request);
608
    int rc;
608
    int rc;
609
 
609
 
610
    link_t *hlp;
610
    link_t *hlp;
611
    unsigned long key[] = {
611
    unsigned long key[] = {
612
        [NODES_KEY_INDEX] = index,
612
        [NODES_KEY_INDEX] = index,
613
        [NODES_KEY_DEV] = dev_handle
613
        [NODES_KEY_DEV] = dev_handle
614
    };
614
    };
615
    hlp = hash_table_find(&nodes, key);
615
    hlp = hash_table_find(&nodes, key);
616
    if (!hlp) {
616
    if (!hlp) {
617
        ipc_answer_0(rid, ENOENT);
617
        ipc_answer_0(rid, ENOENT);
618
        return;
618
        return;
619
    }
619
    }
620
    tmpfs_node_t *nodep = hash_table_get_instance(hlp, tmpfs_node_t,
620
    tmpfs_node_t *nodep = hash_table_get_instance(hlp, tmpfs_node_t,
621
        nh_link);
621
        nh_link);
622
    rc = tmpfs_destroy_node(FS_NODE(nodep));
622
    rc = tmpfs_destroy_node(FS_NODE(nodep));
623
    ipc_answer_0(rid, rc);
623
    ipc_answer_0(rid, rc);
624
}
624
}
625
 
625
 
626
void tmpfs_open_node(ipc_callid_t rid, ipc_call_t *request)
626
void tmpfs_open_node(ipc_callid_t rid, ipc_call_t *request)
627
{
627
{
628
    libfs_open_node(&tmpfs_libfs_ops, tmpfs_reg.fs_handle, rid, request);
628
    libfs_open_node(&tmpfs_libfs_ops, tmpfs_reg.fs_handle, rid, request);
629
}
629
}
630
 
630
 
631
void tmpfs_device(ipc_callid_t rid, ipc_call_t *request)
631
void tmpfs_stat(ipc_callid_t rid, ipc_call_t *request)
632
{
632
{
633
    ipc_answer_0(rid, ENOTSUP);
633
    libfs_stat(&tmpfs_libfs_ops, tmpfs_reg.fs_handle, rid, request);
634
}
634
}
635
 
635
 
636
void tmpfs_sync(ipc_callid_t rid, ipc_call_t *request)
636
void tmpfs_sync(ipc_callid_t rid, ipc_call_t *request)
637
{
637
{
638
    /* Dummy implementation */
638
    /* Dummy implementation */
639
    ipc_answer_0(rid, EOK);
639
    ipc_answer_0(rid, EOK);
640
}
640
}
641
 
641
 
642
/**
642
/**
643
 * @}
643
 * @}
644
 */
644
 */
645
 
645