Subversion Repositories HelenOS

Rev

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

Rev 2393 Rev 2435
Line -... Line 1...
-
 
1
/*
1
/* Functions for connecting to some services, which is needed for FS. */
2
 * Copyright (c) 2007 Konopa-Jelen-Majer
-
 
3
 * All rights reserved.
2
 
4
 *
-
 
5
 * Redistribution and use in source and binary forms, with or without
-
 
6
 * modification, are permitted provided that the following conditions
3
/* Methods:
7
 * are met:
-
 
8
 *
4
 * common_connection:   includes common aspects for connecting to some services
9
 * - Redistributions of source code must retain the above copyright
5
 * con_connection:  connects to SERVICE_CONSOLE
10
 *   notice, this list of conditions and the following disclaimer.
6
 * rd_connection:   connects to SERVICE_RD
11
 * - Redistributions in binary form must reproduce the above copyright
-
 
12
 *   notice, this list of conditions and the following disclaimer in the
7
 * fs_connection:   connects to SERVICE_FS
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.
8
 *
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.
-
 
27
 */
-
 
28
 
-
 
29
/** @addtogroup FileSystemTask
-
 
30
 * @{
9
 */
31
 */
10
 
32
 
-
 
33
/**
-
 
34
 * @file    connect.h
-
 
35
 * @brief    Functions for connecting to some services, which is needed for FS.
-
 
36
 */
-
 
37
 
11
#include <ipc/ipc.h>
38
#include <ipc/ipc.h>
12
#include <ipc/services.h>
39
#include <ipc/services.h>
13
#include "../fs/fs.h"
40
#include "../fs/fs.h"
14
 
41
 
15
 
42
/**
-
 
43
 * Includes common aspects for connecting to some services
-
 
44
 */
16
int common_connection(int *phone, int service, int attempts)
45
int common_connection(int *phone, int service, int attempts)
17
{
46
{
18
   
47
   
19
    int i;
48
    int i;
20
 
49
 
Line 34... Line 63...
34
        return TRUE;
63
        return TRUE;
35
 
64
 
36
    return FALSE;
65
    return FALSE;
37
}
66
}
38
 
67
 
39
 
68
/**
-
 
69
 * Connects to SERVICE_CONSOLE
-
 
70
 */
40
int connect_to_con(int *phone, int attempts)
71
int connect_to_con(int *phone, int attempts)
41
{
72
{
42
   
73
   
43
    if (common_connection(phone, SERVICE_CONSOLE, attempts))
74
    if (common_connection(phone, SERVICE_CONSOLE, attempts))
44
        return TRUE;
75
        return TRUE;
45
 
76
 
46
    return FALSE;  
77
    return FALSE;  
47
}
78
}
48
 
79
 
-
 
80
/**
-
 
81
 * Connects to SERVICE_RD
-
 
82
 */
49
int connect_to_rd(int *phone, int attempts)
83
int connect_to_rd(int *phone, int attempts)
50
{
84
{
51
       
85
       
52
    if (common_connection(phone, SERVICE_RD, attempts))
86
    if (common_connection(phone, SERVICE_RD, attempts))
53
        return TRUE;
87
        return TRUE;
54
 
88
 
55
    return FALSE;  
89
    return FALSE;  
56
}
90
}
57
 
91
 
-
 
92
/**
-
 
93
 * Connects to SERVICE_FS
-
 
94
 */
58
int connect_to_fs(int *phone, int attempts)
95
int connect_to_fs(int *phone, int attempts)
59
{
96
{
60
       
97
       
61
    if (common_connection(phone, SERVICE_FS, attempts))
98
    if (common_connection(phone, SERVICE_FS, attempts))
62
        return TRUE;
99
        return TRUE;
63
 
100
 
64
    return FALSE;  
101
    return FALSE;  
65
}
102
}
-
 
103
 
-
 
104
/**
-
 
105
 *}
-
 
106
 */
-
 
107