Changeset 63a3276 in mainline for uspace/srv/vfs/vfs_register.c
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.