Subversion Repositories HelenOS

Rev

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

Rev 2518 Rev 2619
Line 88... Line 88...
88
    if (!fs_va) {
88
    if (!fs_va) {
89
        /*
89
        /*
90
         * Hang up the phone if we cannot proceed any further.
90
         * Hang up the phone if we cannot proceed any further.
91
         * This is the answer to the call that opened the connection.
91
         * This is the answer to the call that opened the connection.
92
         */
92
         */
93
        ipc_answer_fast(iid, EHANGUP, 0, 0);
93
        ipc_answer_0(iid, EHANGUP);
94
        return;
94
        return;
95
    } else {
95
    } else {
96
        /*
96
        /*
97
         * Answer the first IPC_M_CONNECT_ME_TO call.
97
         * Answer the first IPC_M_CONNECT_ME_TO call.
98
         * Return supported block size as ARG1.
98
         * Return supported block size as ARG1.
99
         */
99
         */
100
        ipc_answer_fast(iid, EOK, BLOCK_SIZE, 0);
100
        ipc_answer_1(iid, EOK, BLOCK_SIZE);
101
    }
101
    }
102
 
102
 
103
    /*
103
    /*
104
     * Now we wait for the client to send us its communication as_area.
104
     * Now we wait for the client to send us its communication as_area.
105
     */
105
     */
Line 108... Line 108...
108
        if (IPC_GET_ARG1(call) >= (ipcarg_t) BLOCK_SIZE) {
108
        if (IPC_GET_ARG1(call) >= (ipcarg_t) BLOCK_SIZE) {
109
            /*
109
            /*
110
             * The client sends an as_area that can absorb the whole
110
             * The client sends an as_area that can absorb the whole
111
             * block.
111
             * block.
112
             */
112
             */
113
            ipc_answer_fast(callid, EOK, (uintptr_t) fs_va, 0);
113
            ipc_answer_1(callid, EOK, (uintptr_t) fs_va);
114
        } else {
114
        } else {
115
            /*
115
            /*
116
             * The client offered as_area too small.
116
             * The client offered as_area too small.
117
             * Close the connection.
117
             * Close the connection.
118
             */
118
             */
119
            ipc_answer_fast(callid, EHANGUP, 0, 0);
119
            ipc_answer_0(callid, EHANGUP);
120
            return;    
120
            return;    
121
        }
121
        }
122
    } else {
122
    } else {
123
        /*
123
        /*
124
         * The client doesn't speak the same protocol.
124
         * The client doesn't speak the same protocol.
125
         * At this point we can't handle protocol variations.
125
         * At this point we can't handle protocol variations.
126
         * Close the connection.
126
         * Close the connection.
127
         */
127
         */
128
        ipc_answer_fast(callid, EHANGUP, 0, 0);
128
        ipc_answer_0(callid, EHANGUP);
129
        return;
129
        return;
130
    }
130
    }
131
   
131
   
132
    while (1) {
132
    while (1) {
133
        callid = async_get_call(&call);
133
        callid = async_get_call(&call);
Line 135... Line 135...
135
        case IPC_M_PHONE_HUNGUP:
135
        case IPC_M_PHONE_HUNGUP:
136
            /*
136
            /*
137
             * The other side has hung up.
137
             * The other side has hung up.
138
             * Answer the message and exit the fibril.
138
             * Answer the message and exit the fibril.
139
             */
139
             */
140
            ipc_answer_fast(callid, EOK, 0, 0);
140
            ipc_answer_0(callid, EOK);
141
            return;
141
            return;
142
        case RD_READ_BLOCK:
142
        case RD_READ_BLOCK:
143
            offset = IPC_GET_ARG1(call);
143
            offset = IPC_GET_ARG1(call);
144
            if (offset * BLOCK_SIZE > rd_size - BLOCK_SIZE) {
144
            if (offset * BLOCK_SIZE > rd_size - BLOCK_SIZE) {
145
                /*
145
                /*
Line 175... Line 175...
175
             * newer version of the protocol.
175
             * newer version of the protocol.
176
             */
176
             */
177
            retval = EINVAL;
177
            retval = EINVAL;
178
            break;
178
            break;
179
        }
179
        }
180
        ipc_answer_fast(callid, retval, 0, 0);
180
        ipc_answer_0(callid, retval);
181
    }
181
    }
182
}
182
}
183
 
183
 
184
/** Prepare the ramdisk image for operation. */
184
/** Prepare the ramdisk image for operation. */
185
static bool rd_init(void)
185
static bool rd_init(void)