Subversion Repositories HelenOS

Rev

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

Rev 2787 Rev 4377
Line 26... Line 26...
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    vfs_register.c
34
 * @file vfs_register.c
35
 * @brief
35
 * @brief
36
 */
36
 */
37
 
37
 
38
#include <ipc/ipc.h>
38
#include <ipc/ipc.h>
39
#include <ipc/services.h>
39
#include <ipc/services.h>
Line 96... Line 96...
96
    if (info->name[i] != '\0') {
96
    if (info->name[i] != '\0') {
97
        dprintf("The name is not properly NULL-terminated.\n");
97
        dprintf("The name is not properly NULL-terminated.\n");
98
        return false;
98
        return false;
99
    }
99
    }
100
   
100
   
101
 
-
 
102
    /*
-
 
103
     * Check if the FS implements mandatory VFS operations.
-
 
104
     */
-
 
105
    if (info->ops[IPC_METHOD_TO_VFS_OP(VFS_LOOKUP)] != VFS_OP_DEFINED) {
-
 
106
        dprintf("Operation VFS_LOOKUP not defined by the client.\n");
-
 
107
        return false;
-
 
108
    }
-
 
109
    if (info->ops[IPC_METHOD_TO_VFS_OP(VFS_READ)] != VFS_OP_DEFINED) {
-
 
110
        dprintf("Operation VFS_READ not defined by the client.\n");
-
 
111
        return false;
-
 
112
    }
-
 
113
   
-
 
114
    /*
-
 
115
     * Check if each operation is either not defined, defined or default.
-
 
116
     */
-
 
117
    for (i = VFS_FIRST; i < VFS_LAST_CLNT; i++) {
-
 
118
        if ((info->ops[IPC_METHOD_TO_VFS_OP(i)] != VFS_OP_NULL) &&
-
 
119
            (info->ops[IPC_METHOD_TO_VFS_OP(i)] != VFS_OP_DEFAULT) &&
-
 
120
            (info->ops[IPC_METHOD_TO_VFS_OP(i)] != VFS_OP_DEFINED)) {
-
 
121
            dprintf("Operation info not understood.\n");
-
 
122
            return false;
-
 
123
        }
-
 
124
    }
-
 
125
    return true;
101
    return true;
126
}
102
}
127
 
103
 
128
/** VFS_REGISTER protocol function.
104
/** VFS_REGISTER protocol function.
129
 *
105
 *
Line 300... Line 276...
300
    fibril_dec_sercount();
276
    fibril_dec_sercount();
301
    futex_up(&fs_head_futex);
277
    futex_up(&fs_head_futex);
302
   
278
   
303
    dprintf("\"%.*s\" filesystem successfully registered, handle=%d.\n",
279
    dprintf("\"%.*s\" filesystem successfully registered, handle=%d.\n",
304
        FS_NAME_MAXLEN, fs_info->vfs_info.name, fs_info->fs_handle);
280
        FS_NAME_MAXLEN, fs_info->vfs_info.name, fs_info->fs_handle);
-
 
281
   
-
 
282
    /* Process pending mount requests possibly waiting
-
 
283
     * for this filesystem implementation.
-
 
284
     */
-
 
285
    vfs_process_pending_mount();
305
}
286
}
306
 
287
 
307
/** For a given file system handle, implement policy for allocating a phone.
288
/** For a given file system handle, implement policy for allocating a phone.
308
 *
289
 *
309
 * @param handle    File system handle.
290
 * @param handle    File system handle.
Line 393... Line 374...
393
    if (lock)
374
    if (lock)
394
        futex_down(&fs_head_futex);
375
        futex_down(&fs_head_futex);
395
    link_t *cur;
376
    link_t *cur;
396
    for (cur = fs_head.next; cur != &fs_head; cur = cur->next) {
377
    for (cur = fs_head.next; cur != &fs_head; cur = cur->next) {
397
        fs_info_t *fs = list_get_instance(cur, fs_info_t, fs_link);
378
        fs_info_t *fs = list_get_instance(cur, fs_info_t, fs_link);
398
        if (strncmp(fs->vfs_info.name, name,
379
        if (str_cmp(fs->vfs_info.name, name) == 0) {
399
            sizeof(fs->vfs_info.name)) == 0) {
-
 
400
            handle = fs->fs_handle;
380
            handle = fs->fs_handle;
401
            break;
381
            break;
402
        }
382
        }
403
    }
383
    }
404
    if (lock)
384
    if (lock)