Rev 2771 | Rev 3214 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2771 | Rev 3077 | ||
---|---|---|---|
Line 46... | Line 46... | ||
46 | #include <async.h> |
46 | #include <async.h> |
47 | #include <atomic.h> |
47 | #include <atomic.h> |
48 | #include <futex.h> |
48 | #include <futex.h> |
49 | #include <errno.h> |
49 | #include <errno.h> |
50 | #include <string.h> |
50 | #include <string.h> |
- | 51 | #include <ipc/devmap.h> |
|
51 | #include "../../srv/vfs/vfs.h" |
52 | #include "../../srv/vfs/vfs.h" |
52 | 53 | ||
53 | int vfs_phone = -1; |
54 | int vfs_phone = -1; |
54 | futex_t vfs_phone_futex = FUTEX_INITIALIZER; |
55 | futex_t vfs_phone_futex = FUTEX_INITIALIZER; |
55 | 56 | ||
Line 100... | Line 101... | ||
100 | if (vfs_phone < 0) |
101 | if (vfs_phone < 0) |
101 | vfs_phone = ipc_connect_me_to(PHONE_NS, SERVICE_VFS, 0, 0); |
102 | vfs_phone = ipc_connect_me_to(PHONE_NS, SERVICE_VFS, 0, 0); |
102 | return vfs_phone; |
103 | return vfs_phone; |
103 | } |
104 | } |
104 | 105 | ||
- | 106 | static int device_get_handle(char *name, dev_handle_t *handle) |
|
- | 107 | { |
|
- | 108 | int phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAP, DEVMAP_CLIENT, 0); |
|
- | 109 | if (phone < 0) |
|
- | 110 | return phone; |
|
- | 111 | ||
- | 112 | ipc_call_t answer; |
|
- | 113 | aid_t req = async_send_2(phone, DEVMAP_DEVICE_GET_HANDLE, 0, 0, |
|
- | 114 | &answer); |
|
- | 115 | ||
- | 116 | ipcarg_t retval = ipc_data_write_start(phone, name, strlen(name) + 1); |
|
- | 117 | ||
- | 118 | if (retval != EOK) { |
|
- | 119 | async_wait_for(req, NULL); |
|
- | 120 | ipc_hangup(phone); |
|
- | 121 | return retval; |
|
- | 122 | } |
|
- | 123 | ||
- | 124 | async_wait_for(req, &retval); |
|
- | 125 | ||
- | 126 | if (handle != NULL) |
|
- | 127 | *handle = -1; |
|
- | 128 | ||
- | 129 | if (retval == EOK) { |
|
- | 130 | if (handle != NULL) |
|
- | 131 | *handle = (dev_handle_t) IPC_GET_ARG1(answer); |
|
- | 132 | } |
|
- | 133 | ||
- | 134 | ipc_hangup(phone); |
|
- | 135 | return retval; |
|
- | 136 | } |
|
- | 137 | ||
105 | int mount(const char *fs_name, const char *mp, const char *dev) |
138 | int mount(const char *fs_name, const char *mp, const char *dev) |
106 | { |
139 | { |
107 | int res; |
140 | int res; |
108 | ipcarg_t rc; |
141 | ipcarg_t rc; |
109 | aid_t req; |
142 | aid_t req; |
- | 143 | dev_handle_t dev_handle; |
|
110 | 144 | ||
111 | dev_handle_t dev_handle = 0; /* TODO */ |
145 | res = device_get_handle(dev, &dev_handle); |
- | 146 | if (res != EOK) |
|
- | 147 | return res; |
|
112 | 148 | ||
113 | size_t mpa_len; |
149 | size_t mpa_len; |
114 | char *mpa = absolutize(mp, &mpa_len); |
150 | char *mpa = absolutize(mp, &mpa_len); |
115 | if (!mpa) |
151 | if (!mpa) |
116 | return ENOMEM; |
152 | return ENOMEM; |
117 | 153 |