Changeset 1db44ea7 in mainline for uspace/srv
- Timestamp:
- 2011-09-25T18:46:45Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 36cb22f
- Parents:
- dcc44ca1 (diff), f9d8c3a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace/srv
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/devman/main.c
rdcc44ca1 r1db44ea7 490 490 if (rc == EOK) { 491 491 loc_service_add_to_cat(fun->service_id, cat_id); 492 log_msg(LVL_NOTE, "Function `%s' added to category `%s'.", 493 fun->pathname, cat_name); 492 494 } else { 493 495 log_msg(LVL_ERROR, "Failed adding function `%s' to category " … … 495 497 } 496 498 497 log_msg(LVL_NOTE, "Function `%s' added to category `%s'.",498 fun->pathname, cat_name);499 500 499 fibril_rwlock_read_unlock(&device_tree.rwlock); 501 500 fun_del_ref(fun); 502 503 async_answer_0(callid, EOK);501 502 async_answer_0(callid, rc); 504 503 } 505 504 -
uspace/srv/fs/cdfs/cdfs.c
rdcc44ca1 r1db44ea7 52 52 .concurrent_read_write = false, 53 53 .write_retains_size = false, 54 .instance = 0, 54 55 }; 55 56 … … 58 59 printf("%s: HelenOS cdfs file system server\n", NAME); 59 60 61 if (argc == 3) { 62 if (!str_cmp(argv[1], "--instance")) 63 cdfs_vfs_info.instance = strtol(argv[2], NULL, 10); 64 else { 65 printf(NAME " Unrecognized parameters"); 66 return -1; 67 } 68 } 69 60 70 if (!cdfs_init()) { 61 71 printf("%s: failed to initialize cdfs\n", NAME); -
uspace/srv/fs/exfat/exfat.c
rdcc44ca1 r1db44ea7 54 54 .name = NAME, 55 55 .concurrent_read_write = false, 56 .write_retains_size = false, 56 .write_retains_size = false, 57 .instance = 0, 57 58 }; 58 59 … … 60 61 { 61 62 printf(NAME ": HelenOS exFAT file system server\n"); 63 64 if (argc == 3) { 65 if (!str_cmp(argv[1], "--instance")) 66 exfat_vfs_info.instance = strtol(argv[2], NULL, 10); 67 else { 68 printf(NAME " Unrecognized parameters"); 69 return -1; 70 } 71 } 62 72 63 73 int rc = exfat_idx_init(); -
uspace/srv/fs/ext2fs/ext2fs.c
rdcc44ca1 r1db44ea7 52 52 vfs_info_t ext2fs_vfs_info = { 53 53 .name = NAME, 54 .instance = 0, 54 55 }; 55 56 … … 57 58 { 58 59 printf(NAME ": HelenOS EXT2 file system server\n"); 60 61 if (argc == 3) { 62 if (!str_cmp(argv[1], "--instance")) 63 ext2fs_vfs_info.instance = strtol(argv[2], NULL, 10); 64 else { 65 printf(NAME " Unrecognized parameters"); 66 return -1; 67 } 68 } 59 69 60 70 async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE, -
uspace/srv/fs/fat/fat.c
rdcc44ca1 r1db44ea7 54 54 .name = NAME, 55 55 .concurrent_read_write = false, 56 .write_retains_size = false, 56 .write_retains_size = false, 57 .instance = 0, 57 58 }; 58 59 … … 61 62 printf(NAME ": HelenOS FAT file system server\n"); 62 63 64 if (argc == 3) { 65 if (!str_cmp(argv[1], "--instance")) 66 fat_vfs_info.instance = strtol(argv[2], NULL, 10); 67 else { 68 printf(NAME " Unrecognized parameters"); 69 return -1; 70 } 71 } 72 63 73 int rc = fat_idx_init(); 64 74 if (rc != EOK) -
uspace/srv/fs/fat/fat.h
rdcc44ca1 r1db44ea7 230 230 } fat_node_t; 231 231 232 typedef struct { 233 bool lfn_enabled; 234 } fat_instance_t; 235 232 236 extern vfs_out_ops_t fat_ops; 233 237 extern libfs_ops_t fat_libfs_ops; -
uspace/srv/fs/fat/fat_directory.c
rdcc44ca1 r1db44ea7 262 262 { 263 263 int rc; 264 bool enable_lfn = true; /* TODO: make this a mount option */ 264 void *data; 265 fat_instance_t *instance; 266 267 rc = fs_instance_get(di->nodep->idx->service_id, &data); 268 assert(rc == EOK); 269 instance = (fat_instance_t *) data; 265 270 266 271 if (fat_valid_short_name(name)) { … … 277 282 rc = fat_directory_write_dentry(di, de); 278 283 return rc; 279 } else if ( enable_lfn&& fat_valid_name(name)) {284 } else if (instance->lfn_enabled && fat_valid_name(name)) { 280 285 /* We should create long entries to store name */ 281 286 int long_entry_count; … … 292 297 if (lfn_size % FAT_LFN_ENTRY_SIZE) 293 298 long_entry_count++; 294 rc = fat_directory_lookup_free(di, long_entry_count +1);299 rc = fat_directory_lookup_free(di, long_entry_count + 1); 295 300 if (rc != EOK) 296 301 return rc; … … 328 333 FAT_LFN_ORDER(d) |= FAT_LFN_LAST; 329 334 330 rc = fat_directory_seek(di, start_pos +long_entry_count);335 rc = fat_directory_seek(di, start_pos + long_entry_count); 331 336 return rc; 332 337 } -
uspace/srv/fs/fat/fat_ops.c
rdcc44ca1 r1db44ea7 871 871 aoff64_t *size, unsigned *linkcnt) 872 872 { 873 enum cache_mode cmode ;873 enum cache_mode cmode = CACHE_MODE_WB; 874 874 fat_bs_t *bs; 875 int rc; 876 877 /* Check for option enabling write through. */ 878 if (str_cmp(opts, "wtcache") == 0) 879 cmode = CACHE_MODE_WT; 880 else 881 cmode = CACHE_MODE_WB; 875 fat_instance_t *instance; 876 int rc; 877 878 instance = malloc(sizeof(fat_instance_t)); 879 if (!instance) 880 return ENOMEM; 881 instance->lfn_enabled = true; 882 883 /* Parse mount options. */ 884 char *mntopts = (char *) opts; 885 char *saveptr; 886 char *opt; 887 while ((opt = strtok_r(mntopts, " ,", &saveptr)) != NULL) { 888 if (str_cmp(opt, "wtcache") == 0) 889 cmode = CACHE_MODE_WT; 890 else if (str_cmp(opt, "nolfn") == 0) 891 instance->lfn_enabled = false; 892 mntopts = NULL; 893 } 882 894 883 895 /* initialize libblock */ 884 896 rc = block_init(EXCHANGE_SERIALIZE, service_id, BS_SIZE); 885 if (rc != EOK) 886 return rc; 897 if (rc != EOK) { 898 free(instance); 899 return rc; 900 } 887 901 888 902 /* prepare the boot block */ 889 903 rc = block_bb_read(service_id, BS_BLOCK); 890 904 if (rc != EOK) { 905 free(instance); 891 906 block_fini(service_id); 892 907 return rc; … … 897 912 898 913 if (BPS(bs) != BS_SIZE) { 914 free(instance); 899 915 block_fini(service_id); 900 916 return ENOTSUP; … … 904 920 rc = block_cache_init(service_id, BPS(bs), 0 /* XXX */, cmode); 905 921 if (rc != EOK) { 922 free(instance); 906 923 block_fini(service_id); 907 924 return rc; … … 911 928 rc = fat_sanity_check(bs, service_id); 912 929 if (rc != EOK) { 930 free(instance); 913 931 (void) block_cache_fini(service_id); 914 932 block_fini(service_id); … … 918 936 rc = fat_idx_init_by_service_id(service_id); 919 937 if (rc != EOK) { 938 free(instance); 920 939 (void) block_cache_fini(service_id); 921 940 block_fini(service_id); … … 926 945 fs_node_t *rfn = (fs_node_t *)malloc(sizeof(fs_node_t)); 927 946 if (!rfn) { 947 free(instance); 928 948 (void) block_cache_fini(service_id); 929 949 block_fini(service_id); … … 935 955 fat_node_t *rootp = (fat_node_t *)malloc(sizeof(fat_node_t)); 936 956 if (!rootp) { 957 free(instance); 937 958 free(rfn); 938 959 (void) block_cache_fini(service_id); … … 945 966 fat_idx_t *ridxp = fat_idx_get_by_pos(service_id, FAT_CLST_ROOTPAR, 0); 946 967 if (!ridxp) { 968 free(instance); 947 969 free(rfn); 948 970 free(rootp); … … 964 986 rc = fat_clusters_get(&clusters, bs, service_id, rootp->firstc); 965 987 if (rc != EOK) { 988 fibril_mutex_unlock(&ridxp->lock); 989 free(instance); 966 990 free(rfn); 967 991 free(rootp); … … 974 998 } else 975 999 rootp->size = RDE(bs) * sizeof(fat_dentry_t); 1000 1001 rc = fs_instance_create(service_id, instance); 1002 if (rc != EOK) { 1003 fibril_mutex_unlock(&ridxp->lock); 1004 free(instance); 1005 free(rfn); 1006 free(rootp); 1007 (void) block_cache_fini(service_id); 1008 block_fini(service_id); 1009 fat_idx_fini_by_service_id(service_id); 1010 return rc; 1011 } 976 1012 977 1013 rootp->idx = ridxp; … … 1024 1060 (void) block_cache_fini(service_id); 1025 1061 block_fini(service_id); 1062 1063 void *data; 1064 if (fs_instance_get(service_id, &data) == EOK) { 1065 fs_instance_destroy(service_id); 1066 free(data); 1067 } 1026 1068 1027 1069 return EOK; -
uspace/srv/fs/locfs/locfs.c
rdcc44ca1 r1db44ea7 55 55 .concurrent_read_write = false, 56 56 .write_retains_size = false, 57 .instance = 0, 57 58 }; 58 59 … … 61 62 printf("%s: HelenOS Device Filesystem\n", NAME); 62 63 64 if (argc == 3) { 65 if (!str_cmp(argv[1], "--instance")) 66 locfs_vfs_info.instance = strtol(argv[2], NULL, 10); 67 else { 68 printf(NAME " Unrecognized parameters"); 69 return -1; 70 } 71 } 72 73 63 74 if (!locfs_init()) { 64 75 printf("%s: failed to initialize locfs\n", NAME); -
uspace/srv/fs/locfs/locfs_ops.c
rdcc44ca1 r1db44ea7 593 593 sysarg_t rc; 594 594 async_wait_for(msg, &rc); 595 596 /* Do not propagate EHANGUP back to VFS. */ 597 if ((int) rc == EHANGUP) 598 rc = ENOTSUP; 595 599 596 600 *rbytes = IPC_GET_ARG1(answer); … … 655 659 sysarg_t rc; 656 660 async_wait_for(msg, &rc); 661 662 /* Do not propagate EHANGUP back to VFS. */ 663 if ((int) rc == EHANGUP) 664 rc = ENOTSUP; 657 665 658 666 *wbytes = IPC_GET_ARG1(answer); -
uspace/srv/fs/mfs/mfs.c
rdcc44ca1 r1db44ea7 39 39 40 40 #include <ipc/services.h> 41 #include <stdlib.h> 42 #include <str.h> 41 43 #include <ns.h> 42 44 #include <async.h> … … 52 54 .concurrent_read_write = false, 53 55 .write_retains_size = false, 56 .instance = 0, 54 57 }; 55 58 … … 59 62 60 63 printf(NAME ": HelenOS Minix file system server\n"); 64 65 if (argc == 3) { 66 if (!str_cmp(argv[1], "--instance")) 67 mfs_vfs_info.instance = strtol(argv[2], NULL, 10); 68 else { 69 printf(NAME " Unrecognized parameters"); 70 rc = -1; 71 goto err; 72 } 73 } 61 74 62 75 async_sess_t *vfs_sess = service_connect_blocking(EXCHANGE_SERIALIZE, -
uspace/srv/fs/mfs/mfs.h
rdcc44ca1 r1db44ea7 131 131 132 132 struct mfs_instance { 133 link_t link;134 133 service_id_t service_id; 135 134 struct mfs_sb_info *sbi; -
uspace/srv/fs/mfs/mfs_ops.c
rdcc44ca1 r1db44ea7 73 73 74 74 75 static LIST_INITIALIZE(inst_list);76 static FIBRIL_MUTEX_INITIALIZE(inst_list_mutex);77 75 static hash_table_t open_nodes; 78 76 static FIBRIL_MUTEX_INITIALIZE(open_nodes_lock); … … 178 176 goto out_error; 179 177 } 180 181 instance->open_nodes_cnt = 0;182 178 183 179 sb = malloc(MFS_SUPERBLOCK_SIZE); … … 271 267 } 272 268 273 /*Initialize the instance structure and add it to the list*/ 274 link_initialize(&instance->link); 269 /*Initialize the instance structure and remember it*/ 275 270 instance->service_id = service_id; 276 271 instance->sbi = sbi; 277 278 fibril_mutex_lock(&inst_list_mutex); 279 list_append(&instance->link, &inst_list); 280 fibril_mutex_unlock(&inst_list_mutex); 272 instance->open_nodes_cnt = 0; 273 rc = fs_instance_create(service_id, instance); 274 if (rc != EOK) { 275 free(instance); 276 free(sbi); 277 block_cache_fini(service_id); 278 block_fini(service_id); 279 mfsdebug("fs instance creation failed\n"); 280 return rc; 281 } 281 282 282 283 mfsdebug("mount successful\n"); … … 323 324 block_fini(service_id); 324 325 325 /* Remove the instance from the list */ 326 fibril_mutex_lock(&inst_list_mutex); 327 list_remove(&inst->link); 328 fibril_mutex_unlock(&inst_list_mutex); 329 326 /* Remove and destroy the instance */ 327 (void) fs_instance_destroy(service_id); 330 328 free(inst->sbi); 331 329 free(inst); … … 1020 1018 mfs_instance_get(service_id_t service_id, struct mfs_instance **instance) 1021 1019 { 1022 struct mfs_instance *instance_ptr; 1023 1024 fibril_mutex_lock(&inst_list_mutex); 1025 1026 if (list_empty(&inst_list)) { 1027 fibril_mutex_unlock(&inst_list_mutex); 1028 return EINVAL; 1029 } 1030 1031 list_foreach(inst_list, link) { 1032 instance_ptr = list_get_instance(link, struct mfs_instance, 1033 link); 1034 1035 if (instance_ptr->service_id == service_id) { 1036 *instance = instance_ptr; 1037 fibril_mutex_unlock(&inst_list_mutex); 1038 return EOK; 1039 } 1040 } 1041 1042 mfsdebug("Instance not found\n"); 1043 1044 fibril_mutex_unlock(&inst_list_mutex); 1045 return EINVAL; 1020 void *data; 1021 int rc; 1022 1023 rc = fs_instance_get(service_id, &data); 1024 if (rc == EOK) { 1025 *instance = (struct mfs_instance *) data; 1026 } else { 1027 mfsdebug("instance not found\n"); 1028 } 1029 1030 return rc; 1046 1031 } 1047 1032 -
uspace/srv/fs/tmpfs/tmpfs.c
rdcc44ca1 r1db44ea7 59 59 .concurrent_read_write = false, 60 60 .write_retains_size = false, 61 .instance = 0, 61 62 }; 62 63 … … 64 65 { 65 66 printf(NAME ": HelenOS TMPFS file system server\n"); 67 68 if (argc == 3) { 69 if (!str_cmp(argv[1], "--instance")) 70 tmpfs_vfs_info.instance = strtol(argv[2], NULL, 10); 71 else { 72 printf(NAME " Unrecognized parameters"); 73 return -1; 74 } 75 } 66 76 67 77 if (!tmpfs_init()) { -
uspace/srv/hid/console/console.c
rdcc44ca1 r1db44ea7 344 344 } 345 345 346 static console_t *cons_get_active_uspace(void) 347 { 348 fibril_mutex_lock(&switch_mtx); 349 350 console_t *active_uspace = active_console; 351 if (active_uspace == kernel_console) { 352 active_uspace = prev_console; 353 } 354 assert(active_uspace != kernel_console); 355 356 fibril_mutex_unlock(&switch_mtx); 357 358 return active_uspace; 359 } 360 346 361 static ssize_t limit(ssize_t val, ssize_t lo, ssize_t hi) 347 362 { … … 466 481 event->c = c; 467 482 468 prodcons_produce(&active_console->input_pc, &event->link); 483 /* Kernel console does not read events 484 * from us, so we will redirect them 485 * to the (last) active userspace console 486 * if necessary. 487 */ 488 console_t *target_console = cons_get_active_uspace(); 489 490 prodcons_produce(&target_console->input_pc, 491 &event->link); 469 492 } 470 493 … … 904 927 atomic_set(&consoles[i].refcnt, 0); 905 928 fibril_mutex_initialize(&consoles[i].mtx); 929 prodcons_initialize(&consoles[i].input_pc); 906 930 907 931 if (graphics_state == GRAPHICS_FULL) { … … 942 966 } 943 967 944 prodcons_initialize(&consoles[i].input_pc);945 968 cons_redraw_state(&consoles[i]); 946 969 -
uspace/srv/vfs/vfs.h
rdcc44ca1 r1db44ea7 171 171 extern void vfs_exchange_release(async_exch_t *); 172 172 173 extern fs_handle_t fs_name_to_handle( char *, bool);173 extern fs_handle_t fs_name_to_handle(unsigned int instance, char *, bool); 174 174 extern vfs_info_t *fs_handle_to_info(fs_handle_t); 175 175 -
uspace/srv/vfs/vfs_ops.c
rdcc44ca1 r1db44ea7 146 146 147 147 rindex = (fs_index_t) IPC_GET_ARG1(answer); 148 rsize = (aoff64_t) MERGE_LOUP32(IPC_GET_ARG2(answer), IPC_GET_ARG3(answer)); 148 rsize = (aoff64_t) MERGE_LOUP32(IPC_GET_ARG2(answer), 149 IPC_GET_ARG3(answer)); 149 150 rlnkcnt = (unsigned) IPC_GET_ARG4(answer); 150 151 … … 276 277 277 278 /* 278 * For now, don't make use of ARG3, but it can be used to279 * carry mount options in the future.280 */281 279 * Instance number is passed as ARG3. 280 */ 281 unsigned int instance = IPC_GET_ARG3(*request); 282 282 283 /* We want the client to send us the mount point. */ 283 284 char *mp; … … 335 336 fs_handle_t fs_handle; 336 337 recheck: 337 fs_handle = fs_name_to_handle( fs_name, false);338 fs_handle = fs_name_to_handle(instance, fs_name, false); 338 339 if (!fs_handle) { 339 340 if (flags & IPC_FLAG_BLOCKING) { -
uspace/srv/vfs/vfs_register.c
rdcc44ca1 r1db44ea7 154 154 * Check for duplicit registrations. 155 155 */ 156 if (fs_name_to_handle(fs_info->vfs_info.name, false)) { 156 if (fs_name_to_handle(fs_info->vfs_info.instance, 157 fs_info->vfs_info.name, false)) { 157 158 /* 158 159 * We already register a fs like this. … … 297 298 * 298 299 */ 299 fs_handle_t fs_name_to_handle( char *name, bool lock)300 fs_handle_t fs_name_to_handle(unsigned int instance, char *name, bool lock) 300 301 { 301 302 int handle = 0; … … 306 307 list_foreach(fs_list, cur) { 307 308 fs_info_t *fs = list_get_instance(cur, fs_info_t, fs_link); 308 if (str_cmp(fs->vfs_info.name, name) == 0) { 309 if (str_cmp(fs->vfs_info.name, name) == 0 && 310 instance == fs->vfs_info.instance) { 309 311 handle = fs->fs_handle; 310 312 break;
Note:
See TracChangeset
for help on using the changeset viewer.