Subversion Repositories HelenOS

Rev

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

Rev 2394 Rev 2435
Line -... Line 1...
-
 
1
/*
-
 
2
 * Copyright (c) 2007 Konopa-Jelen-Majer
-
 
3
 * All rights reserved.
-
 
4
 *
1
/* Sending extended well formed messages to FS over
5
 * Redistribution and use in source and binary forms, with or without
-
 
6
 * modification, are permitted provided that the following conditions
-
 
7
 * are met:
-
 
8
 *
-
 
9
 * - Redistributions of source code must retain the above copyright
2
 * standard HelenOS message agrs and over shared buffer.
10
 *   notice, this list of conditions and the following disclaimer.
-
 
11
 * - Redistributions in binary form must reproduce the above copyright
-
 
12
 *   notice, this list of conditions and the following disclaimer in the
-
 
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
-
 
15
 *   derived from this software without specific prior written permission.
-
 
16
 *
-
 
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
-
 
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-
 
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
-
 
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-
 
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
-
 
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
-
 
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3
 */
27
 */
4
 
28
 
-
 
29
/** @addtogroup FileSystemTask
-
 
30
 * @{
-
 
31
 */
-
 
32
 
-
 
33
/**
5
/* Methods:
34
 * @file    message.c
6
 * send_request:    forms and sends extended message to FS
35
 * @brief   Sending extended well formed messages to FS over
7
 * unpack_message:  unpacks message to given message_params_t* structure
36
 *        standard HelenOS message agrs and over shared buffer.
8
 */
37
 */
9
 
38
 
10
 
-
 
11
#include <async.h>
39
#include <async.h>
12
#include <task.h>
40
#include <task.h>
13
#include "../fs/fs.h"
41
#include "../fs/fs.h"
14
#include "message.h"
42
#include "message.h"
15
 
43
 
16
int send_request(int phoneid, ipcarg_t method, message_params_t *params, void *shared_buffer);
44
int send_request(int phoneid, ipcarg_t method, message_params_t *params, void *shared_buffer);
17
void unpack_message(message_params_t *message, ipc_call_t m_input, void *shared_buffer);
45
void unpack_message(message_params_t *message, ipc_call_t m_input, void *shared_buffer);
18
 
46
 
-
 
47
/**
-
 
48
 * Forms and sends extended message to FS
19
/* This method should be used by all callers of FS. Candidate at library function. */  
49
 * This method should be used by all callers of FS. Candidate at library function.
-
 
50
 */
20
int send_request(int phoneid, ipcarg_t method, message_params_t *params, void *shared_buffer)
51
int send_request(int phoneid, ipcarg_t method, message_params_t *params, void *shared_buffer)
21
{
52
{
22
   
53
   
23
    int retval, shift;
54
    int retval, shift;
24
    size_t size;
55
    size_t size;
Line 40... Line 71...
40
    retval = async_req_3(phoneid, method, task_get_id(), params->fd, params->whence, NULL, NULL, NULL);
71
    retval = async_req_3(phoneid, method, task_get_id(), params->fd, params->whence, NULL, NULL, NULL);
41
 
72
 
42
    return retval; 
73
    return retval; 
43
}
74
}
44
 
75
 
-
 
76
/**
-
 
77
 * Unpacks message to given message_params_t* structure
45
/* Will be used by FS to unpacking incoming extended message. */
78
 * Will be used by FS to unpacking incoming extended message.
-
 
79
 */
46
void unpack_message(message_params_t *message, ipc_call_t m_input, void *shared_buffer)
80
void unpack_message(message_params_t *message, ipc_call_t m_input, void *shared_buffer)
47
{
81
{
48
   
82
   
49
    int shift;
83
    int shift;
50
 
84
 
Line 61... Line 95...
61
    memcpy((void *)(&message->fname), (void *)(shared_buffer + shift), DIRSIZEX);
95
    memcpy((void *)(&message->fname), (void *)(shared_buffer + shift), DIRSIZEX);
62
    shift += DIRSIZEX * sizeof(char);
96
    shift += DIRSIZEX * sizeof(char);
63
    memcpy((void *)(&message->entry_number), (void *)(shared_buffer + shift), sizeof(int));
97
    memcpy((void *)(&message->entry_number), (void *)(shared_buffer + shift), sizeof(int));
64
 
98
 
65
}
99
}
-
 
100
 
-
 
101
/**
-
 
102
 *}
-
 
103
 */
-
 
104