Changeset 4979403 in mainline
- Timestamp:
- 2011-09-23T15:39:07Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 286286c
- Parents:
- 8895d05
- git-author:
- Maurizio Lombardi <m.lombardi85@…> (2011-09-23 15:39:07)
- git-committer:
- Jakub Jermar <jakub@…> (2011-09-23 15:39:07)
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
contrib/arch/uspace/srv/vfs/vfs.adl
r8895d05 r4979403 4 4 5 5 /* Mount filesystem */ 6 sysarg_t mount(in sysarg_t device, in sysarg_t flags, in _copy string point, in_copy string opts, in_copy string fs);6 sysarg_t mount(in sysarg_t device, in sysarg_t flags, in sysarg_t instance, in_copy string point, in_copy string opts, in_copy string fs); 7 7 8 8 /* Open file */ … … 56 56 57 57 /* Mount filesystem */ 58 sysarg_t mount(in sysarg_t device, in sysarg_t flags, in _copy string point, in_copy string opts, ...);58 sysarg_t mount(in sysarg_t device, in sysarg_t flags, in sysarg_t instance, in_copy string point, in_copy string opts, ...); 59 59 60 60 /* Open file by node */ -
uspace/app/bdsh/cmds/modules/mount/mount.c
r8895d05 r4979403 43 43 static struct option const long_options[] = { 44 44 { "help", no_argument, 0, 'h' }, 45 { "instance", required_argument, 0, 'i' }, 45 46 { 0, 0, 0, 0 } 46 47 }; … … 68 69 const char *dev = ""; 69 70 int rc, c, opt_ind; 71 unsigned int instance = 0; 72 bool instance_set = false; 73 char **t_argv; 70 74 71 75 argc = cli_count_args(argv); 72 76 73 77 for (c = 0, optind = 0, opt_ind = 0; c != -1;) { 74 c = getopt_long(argc, argv, " h", long_options, &opt_ind);78 c = getopt_long(argc, argv, "i:h", long_options, &opt_ind); 75 79 switch (c) { 76 80 case 'h': 77 81 help_cmd_mount(HELP_LONG); 78 82 return CMD_SUCCESS; 83 case 'i': 84 instance = (unsigned int) strtol(optarg, NULL, 10); 85 instance_set = true; 86 break; 79 87 } 80 88 } 89 90 if (instance_set) { 91 argc -= 2; 92 t_argv = &argv[2]; 93 } else 94 t_argv = &argv[0]; 81 95 82 96 if ((argc < 3) || (argc > 5)) { … … 86 100 } 87 101 if (argc > 3) 88 dev = argv[3];102 dev = t_argv[3]; 89 103 if (argc == 5) 90 mopts = argv[4];104 mopts = t_argv[4]; 91 105 92 rc = mount( argv[1], argv[2], dev, mopts, 0);106 rc = mount(t_argv[1], t_argv[2], dev, mopts, 0, instance); 93 107 if (rc != EOK) { 94 108 printf("Unable to mount %s filesystem to %s on %s (rc=%d)\n", 95 argv[1], argv[2],argv[3], rc);109 t_argv[1], t_argv[2], t_argv[3], rc); 96 110 return CMD_FAILURE; 97 111 } -
uspace/app/init/init.c
r8895d05 r4979403 121 121 122 122 int rc = mount(fstype, ROOT_MOUNT_POINT, ROOT_DEVICE, opts, 123 IPC_FLAG_BLOCKING );123 IPC_FLAG_BLOCKING, 0); 124 124 return mount_report("Root filesystem", ROOT_MOUNT_POINT, fstype, 125 125 ROOT_DEVICE, rc); … … 138 138 { 139 139 int rc = mount(LOCFS_FS_TYPE, LOCFS_MOUNT_POINT, "", "", 140 IPC_FLAG_BLOCKING );140 IPC_FLAG_BLOCKING, 0); 141 141 return mount_report("Location service filesystem", LOCFS_MOUNT_POINT, 142 142 LOCFS_FS_TYPE, NULL, rc); … … 261 261 static bool mount_tmpfs(void) 262 262 { 263 int rc = mount(TMPFS_FS_TYPE, TMPFS_MOUNT_POINT, "", "", 0 );263 int rc = mount(TMPFS_FS_TYPE, TMPFS_MOUNT_POINT, "", "", 0, 0); 264 264 return mount_report("Temporary filesystem", TMPFS_MOUNT_POINT, 265 265 TMPFS_FS_TYPE, NULL, rc); … … 268 268 static bool mount_data(void) 269 269 { 270 int rc = mount(DATA_FS_TYPE, DATA_MOUNT_POINT, DATA_DEVICE, "wtcache", 0 );270 int rc = mount(DATA_FS_TYPE, DATA_MOUNT_POINT, DATA_DEVICE, "wtcache", 0, 0); 271 271 return mount_report("Data filesystem", DATA_MOUNT_POINT, DATA_FS_TYPE, 272 272 DATA_DEVICE, rc); -
uspace/lib/c/generic/vfs/vfs.c
r8895d05 r4979403 143 143 144 144 int mount(const char *fs_name, const char *mp, const char *fqsn, 145 const char *opts, unsigned int flags )145 const char *opts, unsigned int flags, unsigned int instance) 146 146 { 147 147 int null_id = -1; … … 181 181 182 182 sysarg_t rc_orig; 183 aid_t req = async_send_2(exch, VFS_IN_MOUNT, service_id, flags, NULL); 183 aid_t req = async_send_3(exch, VFS_IN_MOUNT, service_id, flags, 184 instance, NULL); 184 185 sysarg_t rc = async_data_write_start(exch, (void *) mpa, mpa_size); 185 186 if (rc != EOK) { -
uspace/lib/c/include/ipc/vfs.h
r8895d05 r4979403 56 56 /** Unique identifier of the fs. */ 57 57 char name[FS_NAME_MAXLEN + 1]; 58 unsigned int instance; 58 59 bool concurrent_read_write; 59 60 bool write_retains_size; -
uspace/lib/c/include/vfs/vfs.h
r8895d05 r4979403 49 49 50 50 extern int mount(const char *, const char *, const char *, const char *, 51 unsigned int );51 unsigned int, unsigned int); 52 52 extern int unmount(const char *); 53 53 -
uspace/srv/fs/cdfs/cdfs.c
r8895d05 r4979403 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
r8895d05 r4979403 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
r8895d05 r4979403 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
r8895d05 r4979403 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/locfs/locfs.c
r8895d05 r4979403 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/mfs/mfs.c
r8895d05 r4979403 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/tmpfs/tmpfs.c
r8895d05 r4979403 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/vfs/vfs.h
r8895d05 r4979403 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
r8895d05 r4979403 276 276 277 277 /* 278 * Instance number is passed as ARG3. 279 */ 280 unsigned int instance = IPC_GET_ARG3(*request); 281 282 /* 278 283 * For now, don't make use of ARG3, but it can be used to 279 284 * carry mount options in the future. … … 335 340 fs_handle_t fs_handle; 336 341 recheck: 337 fs_handle = fs_name_to_handle( fs_name, false);342 fs_handle = fs_name_to_handle(instance, fs_name, false); 338 343 if (!fs_handle) { 339 344 if (flags & IPC_FLAG_BLOCKING) { -
uspace/srv/vfs/vfs_register.c
r8895d05 r4979403 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.