Changeset 63a3276 in mainline for uspace/srv/vfs
- Timestamp:
- 2019-08-06T19:20:35Z (6 years ago)
- Children:
- 3f05ef7
- Parents:
- 72c8f77
- git-author:
- Michal Koutný <xm.koutny+hos@…> (2015-06-17 23:02:03)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2019-08-06 19:20:35)
- Location:
- uspace/srv/vfs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/vfs/vfs.h
r72c8f77 r63a3276 176 176 extern void vfs_exchange_release(async_exch_t *); 177 177 178 extern fs_handle_t fs_name_to_handle( unsigned int instance, const char *, bool);178 extern fs_handle_t fs_name_to_handle(const char *, unsigned int instance, bool); 179 179 extern vfs_info_t *fs_handle_to_info(fs_handle_t); 180 extern errno_t vfs_get_fstypes(vfs_fstypes_t*);180 extern errno_t fs_unit_name(const char *, unsigned int, char **); 181 181 182 182 extern errno_t vfs_lookup_internal(vfs_node_t *, char *, int, vfs_lookup_res_t *); -
uspace/srv/vfs/vfs_ops.c
r72c8f77 r63a3276 136 136 fibril_mutex_lock(&fs_list_lock); 137 137 while (true) { 138 fs_handle = fs_name_to_handle( instance, fsname, false);138 fs_handle = fs_name_to_handle(fsname, instance, false); 139 139 if (!fs_handle) { 140 140 if ((flags & IPC_FLAG_AUTOSTART)) { … … 220 220 char *unit_name = NULL; 221 221 222 assert(instance == 0); 223 /* 224 * Unit name is made simply by considering service of the same name as 225 * given FS name. 226 * TODO instance identifier is not implemented. 227 */ 228 asprintf(&unit_name, "%s%c%s", fs_name, UNIT_NAME_SEPARATOR, 229 UNIT_SVC_TYPE_NAME); 230 if (unit_name == NULL) { 231 return ENOMEM; 232 } 233 234 int rc = sysman_unit_start(unit_name, IPC_FLAG_BLOCKING); 222 errno_t rc = fs_unit_name(fs_name, instance, &unit_name); 223 if (rc != EOK) { 224 return rc; 225 } 226 227 rc = sysman_unit_start(unit_name, IPC_FLAG_BLOCKING); 235 228 236 229 free(unit_name); … … 246 239 247 240 fibril_mutex_lock(&fs_list_lock); 248 fs_handle = fs_name_to_handle( 0, fs_name, false);241 fs_handle = fs_name_to_handle(fs_name, 0, false); 249 242 fibril_mutex_unlock(&fs_list_lock); 250 243 -
uspace/srv/vfs/vfs_register.c
r72c8f77 r63a3276 36 36 */ 37 37 38 #include <ipc/services.h> 38 #include <adt/list.h> 39 #include <as.h> 40 #include <assert.h> 39 41 #include <async.h> 42 #include <atomic.h> 43 #include <ctype.h> 44 #include <errno.h> 40 45 #include <fibril.h> 41 46 #include <fibril_synch.h> 42 #include <errno.h> 47 #include <ipc/services.h> 48 #include <stdbool.h> 43 49 #include <stdio.h> 44 50 #include <stdlib.h> 45 51 #include <str.h> 46 #include <ctype.h> 47 #include <stdbool.h> 48 #include <adt/list.h> 49 #include <as.h> 50 #include <assert.h> 51 #include <stdatomic.h> 52 #include <vfs/vfs.h> 52 #include <sysman/broker.h> 53 53 #include "vfs.h" 54 54 … … 149 149 * Check for duplicit registrations. 150 150 */ 151 if (fs_name_to_handle(fs_info->vfs_info. instance,152 fs_info->vfs_info. name, false)) {151 if (fs_name_to_handle(fs_info->vfs_info.name, 152 fs_info->vfs_info.instance, false)) { 153 153 /* 154 154 * We already register a fs like this. … … 161 161 } 162 162 163 /* Notify sysman about started FS server */ 164 char *unit_name = NULL; 165 rc = fs_unit_name(fs_info->vfs_info.name, fs_info->vfs_info.instance, 166 &unit_name); 167 if (rc != EOK) { 168 dprintf("Unknow unit name for FS server.\n"); 169 fibril_mutex_unlock(&fs_list_lock); 170 free(fs_info); 171 async_answer_0(rid, rc); 172 return; 173 } 174 sysman_main_exposee_added(unit_name, request->in_task_id); 175 free(unit_name); 176 163 177 /* 164 178 * Add fs_info to the list of registered FS's. … … 288 302 * 289 303 * @param name File system name. 304 * @param instance 290 305 * @param lock If true, the function will lock and unlock the 291 306 * fs_list_lock. … … 294 309 * 295 310 */ 296 fs_handle_t fs_name_to_handle( unsigned int instance, const char *name, bool lock)311 fs_handle_t fs_name_to_handle(const char *name, unsigned int instance, bool lock) 297 312 { 298 313 int handle = 0; … … 393 408 } 394 409 410 /** Get name of unit that represents the filesystem server 411 * 412 * Unit name is made simply by considering service of the same name as 413 * given FS name. 414 * TODO instance identifier is not implemented. 415 * 416 * @param[in] fs_name 417 * @param[in] instance 418 * @param[out] unit_name_ptr should be free'd after use, not touched on fail 419 * 420 * @return EOK on success 421 * @return ENOMEM 422 */ 423 errno_t fs_unit_name(const char *fs_name, unsigned int instance, 424 char **unit_name_ptr) 425 { 426 assert(instance == 0); 427 428 char *unit_name = NULL; 429 asprintf(&unit_name, "%s%c%s", fs_name, UNIT_NAME_SEPARATOR, 430 UNIT_SVC_TYPE_NAME); 431 432 if (unit_name == NULL) { 433 return ENOMEM; 434 } else { 435 *unit_name_ptr = unit_name; 436 return EOK; 437 } 438 } 439 395 440 /** 396 441 * @}
Note:
See TracChangeset
for help on using the changeset viewer.
