Rev 4305 | Rev 4482 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4305 | Rev 4401 | ||
|---|---|---|---|
| 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 <devmap.h> |
| 52 | #include "../../../srv/vfs/vfs.h" |
52 | #include "../../../srv/vfs/vfs.h" |
| 53 | 53 | ||
| 54 | int vfs_phone = -1; |
54 | int vfs_phone = -1; |
| 55 | futex_t vfs_phone_futex = FUTEX_INITIALIZER; |
55 | futex_t vfs_phone_futex = FUTEX_INITIALIZER; |
| 56 | 56 | ||
| Line 113... | Line 113... | ||
| 113 | { |
113 | { |
| 114 | while (vfs_phone < 0) |
114 | while (vfs_phone < 0) |
| 115 | vfs_phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_VFS, 0, 0); |
115 | vfs_phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_VFS, 0, 0); |
| 116 | } |
116 | } |
| 117 | 117 | ||
| 118 | static int device_get_handle(const char *name, dev_handle_t *handle, |
- | |
| 119 | const unsigned int flags) |
- | |
| 120 | { |
- | |
| 121 | int phone; |
- | |
| 122 | - | ||
| 123 | if (flags & IPC_FLAG_BLOCKING) |
- | |
| 124 | phone = ipc_connect_me_to_blocking(PHONE_NS, SERVICE_DEVMAP, DEVMAP_CLIENT, 0); |
- | |
| 125 | else |
- | |
| 126 | phone = ipc_connect_me_to(PHONE_NS, SERVICE_DEVMAP, DEVMAP_CLIENT, 0); |
- | |
| 127 | - | ||
| 128 | if (phone < 0) |
- | |
| 129 | return phone; |
- | |
| 130 | - | ||
| 131 | ipc_call_t answer; |
- | |
| 132 | aid_t req = async_send_2(phone, DEVMAP_DEVICE_GET_HANDLE, flags, 0, |
- | |
| 133 | &answer); |
- | |
| 134 | - | ||
| 135 | ipcarg_t retval = ipc_data_write_start(phone, name, str_size(name) + 1); |
- | |
| 136 | - | ||
| 137 | if (retval != EOK) { |
- | |
| 138 | async_wait_for(req, NULL); |
- | |
| 139 | ipc_hangup(phone); |
- | |
| 140 | return retval; |
- | |
| 141 | } |
- | |
| 142 | - | ||
| 143 | async_wait_for(req, &retval); |
- | |
| 144 | - | ||
| 145 | if (handle != NULL) |
- | |
| 146 | *handle = -1; |
- | |
| 147 | - | ||
| 148 | if (retval == EOK) { |
- | |
| 149 | if (handle != NULL) |
- | |
| 150 | *handle = (dev_handle_t) IPC_GET_ARG1(answer); |
- | |
| 151 | } |
- | |
| 152 | - | ||
| 153 | ipc_hangup(phone); |
- | |
| 154 | return retval; |
- | |
| 155 | } |
- | |
| 156 | - | ||
| 157 | int mount(const char *fs_name, const char *mp, const char *dev, |
118 | int mount(const char *fs_name, const char *mp, const char *dev, |
| 158 | const char *opts, const unsigned int flags) |
119 | const char *opts, unsigned int flags) |
| 159 | { |
120 | { |
| 160 | int res; |
121 | int res; |
| 161 | ipcarg_t rc; |
122 | ipcarg_t rc; |
| 162 | aid_t req; |
123 | aid_t req; |
| 163 | dev_handle_t dev_handle; |
124 | dev_handle_t dev_handle; |
| 164 | 125 | ||
| 165 | res = device_get_handle(dev, &dev_handle, flags); |
126 | res = devmap_device_get_handle(dev, &dev_handle, flags); |
| 166 | if (res != EOK) |
127 | if (res != EOK) |
| 167 | return res; |
128 | return res; |
| 168 | 129 | ||
| 169 | size_t mpa_size; |
130 | size_t mpa_size; |
| 170 | char *mpa = absolutize(mp, &mpa_size); |
131 | char *mpa = absolutize(mp, &mpa_size); |