Changeset f0f8787 in mainline for uspace/app/vol/vol.c
- Timestamp:
- 2018-10-04T14:53:29Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c5429fe
- Parents:
- 1bb43d5
- git-author:
- Jiri Svoboda <jiri@…> (2018-10-03 21:51:40)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-10-04 14:53:29)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/vol/vol.c
r1bb43d5 rf0f8787 44 44 #define NAME "vol" 45 45 46 static char *volspec;47 48 46 typedef enum { 49 47 vcmd_eject, 48 vcmd_insert, 50 49 vcmd_help, 51 50 vcmd_list, … … 127 126 if (rc != EOK) { 128 127 printf("Error ejecting volume.\n"); 128 goto out; 129 } 130 131 rc = EOK; 132 out: 133 vol_destroy(vol); 134 return rc; 135 } 136 137 static errno_t vol_cmd_insert(const char *volspec) 138 { 139 vol_t *vol = NULL; 140 service_id_t svc_id; 141 errno_t rc; 142 143 rc = loc_service_get_id(volspec, &svc_id, 0); 144 if (rc != EOK) { 145 printf("Error looking up service '%s'.\n", volspec); 146 goto out; 147 } 148 149 rc = vol_create(&vol); 150 if (rc != EOK) { 151 printf("Error contacting volume service.\n"); 152 goto out; 153 } 154 155 rc = vol_part_insert(vol, svc_id); 156 if (rc != EOK) { 157 printf("Error inserting volume.\n"); 129 158 goto out; 130 159 } … … 215 244 printf(" %s List volumes\n", NAME); 216 245 printf(" %s -h Print help\n", NAME); 217 printf(" %s eject <volume> Eject volume\n", NAME); 246 printf(" %s eject <mp> Eject volume mounted in a directory\n", NAME); 247 printf(" %s insert <svc> Insert volume based on service identifier\n", NAME); 218 248 } 219 249 … … 221 251 { 222 252 char *cmd; 253 char *volspec; 223 254 vol_cmd_t vcmd; 224 255 int i; … … 240 271 } 241 272 volspec = argv[i++]; 273 } else if (str_cmp(cmd, "insert") == 0) { 274 vcmd = vcmd_insert; 275 if (argc <= i) { 276 printf("Parameter missing.\n"); 277 goto syntax_error; 278 } 279 volspec = argv[i++]; 242 280 } else { 243 281 printf("Invalid sub-command '%s'.\n", cmd); … … 254 292 case vcmd_eject: 255 293 rc = vol_cmd_eject(volspec); 294 break; 295 case vcmd_insert: 296 rc = vol_cmd_insert(volspec); 256 297 break; 257 298 case vcmd_help:
Note:
See TracChangeset
for help on using the changeset viewer.