Subversion Repositories HelenOS

Rev

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

Rev 4374 Rev 4400
Line 51... Line 51...
51
#include <align.h>
51
#include <align.h>
52
#include <async.h>
52
#include <async.h>
53
#include <futex.h>
53
#include <futex.h>
54
#include <stdio.h>
54
#include <stdio.h>
55
#include <ipc/devmap.h>
55
#include <ipc/devmap.h>
56
#include "rd.h"
56
#include <ipc/bd.h>
57
 
57
 
58
#define NAME "rd"
58
#define NAME "rd"
59
 
59
 
60
/** Pointer to the ramdisk's image. */
60
/** Pointer to the ramdisk's image. */
61
static void *rd_addr;
61
static void *rd_addr;
Line 120... Line 120...
120
             * The other side has hung up.
120
             * The other side has hung up.
121
             * Answer the message and exit the fibril.
121
             * Answer the message and exit the fibril.
122
             */
122
             */
123
            ipc_answer_0(callid, EOK);
123
            ipc_answer_0(callid, EOK);
124
            return;
124
            return;
125
        case RD_READ_BLOCK:
125
        case BD_READ_BLOCK:
126
            offset = IPC_GET_ARG1(call);
126
            offset = IPC_GET_ARG1(call);
127
            block_size = IPC_GET_ARG2(call);
127
            block_size = IPC_GET_ARG2(call);
128
            if (block_size > maxblock_size) {
128
            if (block_size > maxblock_size) {
129
                /*
129
                /*
130
                 * Maximum block size exceeded.
130
                 * Maximum block size exceeded.
Line 142... Line 142...
142
            futex_down(&rd_futex);
142
            futex_down(&rd_futex);
143
            memcpy(fs_va, rd_addr + offset * block_size, block_size);
143
            memcpy(fs_va, rd_addr + offset * block_size, block_size);
144
            futex_up(&rd_futex);
144
            futex_up(&rd_futex);
145
            retval = EOK;
145
            retval = EOK;
146
            break;
146
            break;
147
        case RD_WRITE_BLOCK:
147
        case BD_WRITE_BLOCK:
148
            offset = IPC_GET_ARG1(call);
148
            offset = IPC_GET_ARG1(call);
149
            block_size = IPC_GET_ARG2(call);
149
            block_size = IPC_GET_ARG2(call);
150
            if (block_size > maxblock_size) {
150
            if (block_size > maxblock_size) {
151
                /*
151
                /*
152
                 * Maximum block size exceeded.
152
                 * Maximum block size exceeded.