Subversion Repositories HelenOS

Rev

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

Rev 2766 Rev 2770
Line 51... Line 51...
51
#include <fcntl.h>
51
#include <fcntl.h>
52
#include <assert.h>
52
#include <assert.h>
53
#include <vfs/canonify.h>
53
#include <vfs/canonify.h>
54
 
54
 
55
/* Forward declarations of static functions. */
55
/* Forward declarations of static functions. */
56
static int vfs_truncate_internal(int, int, unsigned long, size_t);
56
static int vfs_truncate_internal(fs_handle_t, dev_handle_t, fs_index_t, size_t);
57
 
57
 
58
/**
58
/**
59
 * This rwlock prevents the race between a triplet-to-VFS-node resolution and a
59
 * This rwlock prevents the race between a triplet-to-VFS-node resolution and a
60
 * concurrent VFS operation which modifies the file system namespace.
60
 * concurrent VFS operation which modifies the file system namespace.
61
 */
61
 */
Line 66... Line 66...
66
    .fs_handle = 0,
66
    .fs_handle = 0,
67
    .dev_handle = 0,
67
    .dev_handle = 0,
68
    .index = 0,
68
    .index = 0,
69
};
69
};
70
 
70
 
-
 
71
static int
71
static int lookup_root(int fs_handle, int dev_handle, vfs_lookup_res_t *result)
72
lookup_root(fs_handle_t fs_handle, dev_handle_t dev_handle,
-
 
73
    vfs_lookup_res_t *result)
72
{
74
{
73
    vfs_pair_t altroot = {
75
    vfs_pair_t altroot = {
74
        .fs_handle = fs_handle,
76
        .fs_handle = fs_handle,
75
        .dev_handle = dev_handle,
77
        .dev_handle = dev_handle,
76
    };
78
    };
Line 78... Line 80...
78
    return vfs_lookup_internal("/", L_DIRECTORY, result, &altroot);
80
    return vfs_lookup_internal("/", L_DIRECTORY, result, &altroot);
79
}
81
}
80
 
82
 
81
void vfs_mount(ipc_callid_t rid, ipc_call_t *request)
83
void vfs_mount(ipc_callid_t rid, ipc_call_t *request)
82
{
84
{
83
    int dev_handle;
85
    dev_handle_t dev_handle;
84
    vfs_node_t *mp_node = NULL;
86
    vfs_node_t *mp_node = NULL;
85
 
87
 
86
    /*
88
    /*
87
     * We expect the library to do the device-name to device-handle
89
     * We expect the library to do the device-name to device-handle
88
     * translation for us, thus the device handle will arrive as ARG1
90
     * translation for us, thus the device handle will arrive as ARG1
89
     * in the request.
91
     * in the request.
90
     */
92
     */
91
    dev_handle = IPC_GET_ARG1(*request);
93
    dev_handle = (dev_handle_t)IPC_GET_ARG1(*request);
92
 
94
 
93
    /*
95
    /*
94
     * For now, don't make use of ARG2 and ARG3, but they can be used to
96
     * For now, don't make use of ARG2 and ARG3, but they can be used to
95
     * carry mount options in the future.
97
     * carry mount options in the future.
96
     */
98
     */
Line 125... Line 127...
125
   
127
   
126
    /*
128
    /*
127
     * Check if we know a file system with the same name as is in fs_name.
129
     * Check if we know a file system with the same name as is in fs_name.
128
     * This will also give us its file system handle.
130
     * This will also give us its file system handle.
129
     */
131
     */
130
    int fs_handle = fs_name_to_handle(fs_name, true);
132
    fs_handle_t fs_handle = fs_name_to_handle(fs_name, true);
131
    if (!fs_handle) {
133
    if (!fs_handle) {
132
        ipc_answer_0(rid, ENOENT);
134
        ipc_answer_0(rid, ENOENT);
133
        return;
135
        return;
134
    }
136
    }
135
 
137
 
Line 569... Line 571...
569
    }
571
    }
570
    futex_up(&file->lock);
572
    futex_up(&file->lock);
571
    ipc_answer_0(rid, EINVAL);
573
    ipc_answer_0(rid, EINVAL);
572
}
574
}
573
 
575
 
-
 
576
int
574
int vfs_truncate_internal(int fs_handle, int dev_handle, unsigned long index,
577
vfs_truncate_internal(fs_handle_t fs_handle, dev_handle_t dev_handle,
575
    size_t size)
578
    fs_index_t index, size_t size)
576
{
579
{
577
    ipcarg_t rc;
580
    ipcarg_t rc;
578
    int fs_phone;
581
    int fs_phone;
579
   
582
   
580
    fs_phone = vfs_grab_phone(fs_handle);
583
    fs_phone = vfs_grab_phone(fs_handle);