Changeset db9c889 in mainline
- Timestamp:
- 2018-06-29T13:22:39Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 72c72d4
- Parents:
- 5f36841
- git-author:
- Jiri Svoboda <jiri@…> (2018-06-28 17:22:13)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-06-29 13:22:39)
- Files:
-
- 4 added
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
.gitignore
r5f36841 rdb9c889 1 *.a 2 *.check.c 3 *.d 4 *.deflate 1 5 *.disasm 2 *.deflate3 *.a4 *.o5 6 *.la 6 7 *.lo 7 8 *.map 9 *.o 8 10 *.prev 11 *.pyc 9 12 *.so.* 10 *.d 11 *.pyc 12 *.check.c 13 tag 14 tags 15 common.h.new 16 deps.mk 13 /Makefile.common 17 14 /Makefile.config 18 /Makefile.common19 autotool/20 boot/distroot/21 boot/initrd.img22 15 /common.h 23 16 /config.h 24 17 /cscope.out 25 doxygen/doxygen.cfg26 doxygen/doxygen.cfg.gen27 doxygen/html/28 doxygen/latex/29 18 /hdisk.img 19 /image.boot 30 20 /image.iso 31 21 /uImage.bin 32 /image.boot 22 autotool/ 33 23 boot/arch/arm32/_link.ld 34 24 boot/arch/ia64/_link.ld … … 40 30 boot/components.zip 41 31 boot/components_desc.c 32 boot/distroot/ 42 33 boot/image.bin 43 34 boot/image.boot 44 35 boot/image.raw 36 boot/initrd.img 37 common.h.new 38 deps.mk 39 doxygen/doxygen.cfg 40 doxygen/doxygen.cfg.gen 41 doxygen/html/ 42 doxygen/latex/ 43 kernel/arch/abs32le/_link.ld 45 44 kernel/arch/amd64/_link.ld 46 45 kernel/arch/arm32/_link.ld … … 50 49 kernel/arch/ppc32/_link.ld 51 50 kernel/arch/sparc64/_link.ld 52 kernel/arch/abs32le/_link.ld53 51 kernel/generic/src/debug/real_map.bin 54 52 kernel/kernel.bin 55 53 kernel/kernel.dump 56 54 kernel/kernel.raw 55 tag 56 tags 57 tools/amd64-unknown-elf 58 tools/arm-linux-gnueabi 59 tools/binutils-*.tar.bz2 60 tools/downloads/ 61 tools/gcc-*.tar.bz2 62 tools/gdb-*.tar.gz 63 tools/i686-pc-linux-gnu 64 tools/ia64-pc-linux-gnu 65 tools/mips-linux-gnu 66 tools/mips64el-linux-gnu 67 tools/mipsel-linux-gnu 68 tools/ppc-linux-gnu 69 tools/ppc64-linux-gnu 70 tools/riscv64-unknown-linux-gnu 71 tools/sparc64-linux-gnu 72 tools/sycek/ 57 73 uspace/app/barber/barber 58 74 uspace/app/barber/images.c … … 130 146 uspace/app/vlaunch/images_desc.c 131 147 uspace/app/vlaunch/vlaunch 148 uspace/app/vol/vol 132 149 uspace/app/vterm/vterm 133 150 uspace/app/vuhid/vuh … … 135 152 uspace/app/websrv/websrv 136 153 uspace/app/wifi_supplicant/wifi_supplicant 154 uspace/dist/app/ 137 155 uspace/dist/app/barber 138 156 uspace/dist/app/bdsh … … 206 224 uspace/dist/demo.wav 207 225 uspace/dist/demo.xm 226 uspace/dist/drv/ 208 227 uspace/dist/drv/ahci/ 209 228 uspace/dist/drv/apic/ … … 217 236 uspace/dist/drv/i8042/ 218 237 uspace/dist/drv/i8259/ 238 uspace/dist/drv/icp-ic/ 219 239 uspace/dist/drv/icp/ 220 uspace/dist/drv/icp-ic/221 240 uspace/dist/drv/isa/ 222 241 uspace/dist/drv/kfb/ … … 248 267 uspace/dist/drv/vhc/ 249 268 uspace/dist/drv/virt/ 269 uspace/dist/drv/xhci/ 250 270 uspace/dist/drv/xtkbd/ 251 uspace/dist/ drv/xhci/271 uspace/dist/inc/ 252 272 uspace/dist/inc/_link.ld 253 273 uspace/dist/inc/c/ 254 274 uspace/dist/logo.tga 255 uspace/dist/app/256 uspace/dist/drv/257 uspace/dist/inc/258 275 uspace/dist/srv/ 259 276 uspace/dist/test/ … … 275 292 uspace/drv/bus/usb/usbmid/usbmid 276 293 uspace/drv/bus/usb/vhc/vhc 294 uspace/drv/bus/usb/xhci/test-xhci 277 295 uspace/drv/bus/usb/xhci/xhci 278 uspace/drv/bus/usb/xhci/test-xhci279 296 uspace/drv/char/i8042/i8042 280 297 uspace/drv/char/msim-con/msim-con … … 289 306 uspace/drv/hid/adb-mouse/adb-mouse 290 307 uspace/drv/hid/atkbd/atkbd 291 uspace/drv/hid/xtkbd/xtkbd292 308 uspace/drv/hid/ps2mouse/ps2mouse 293 309 uspace/drv/hid/usbhid/usbhid 310 uspace/drv/hid/xtkbd/xtkbd 294 311 uspace/drv/intctl/apic/apic 295 312 uspace/drv/intctl/i8259/i8259 … … 301 318 uspace/drv/nic/rtl8139/rtl8139 302 319 uspace/drv/nic/rtl8169/rtl8169 320 uspace/drv/nic/virtio-net/virtio-net 303 321 uspace/drv/platform/amdm37x/amdm37x 304 322 uspace/drv/platform/icp/icp … … 316 334 uspace/drv/test/test3/test3 317 335 uspace/drv/time/cmos-rtc/cmos-rtc 336 uspace/lib/c/arch/abs32le/_link-dlexe.ld 337 uspace/lib/c/arch/abs32le/_link-loader.ld 338 uspace/lib/c/arch/abs32le/_link-shlib.ld 339 uspace/lib/c/arch/abs32le/_link.ld 318 340 uspace/lib/c/arch/amd64/_link-dlexe.ld 319 341 uspace/lib/c/arch/amd64/_link-loader.ld … … 348 370 uspace/lib/c/arch/sparc64/_link-shlib.ld 349 371 uspace/lib/c/arch/sparc64/_link.ld 350 uspace/lib/c/arch/abs32le/_link-dlexe.ld351 uspace/lib/c/arch/abs32le/_link-loader.ld352 uspace/lib/c/arch/abs32le/_link-shlib.ld353 uspace/lib/c/arch/abs32le/_link.ld354 372 uspace/lib/c/test-libc 355 373 uspace/lib/label/test-liblabel … … 408 426 uspace/srv/vfs/vfs 409 427 uspace/srv/volsrv/volsrv 410 tools/amd64-unknown-elf411 tools/arm-linux-gnueabi412 tools/i686-pc-linux-gnu413 tools/ia64-pc-linux-gnu414 tools/mips-linux-gnu415 tools/mips64el-linux-gnu416 tools/mipsel-linux-gnu417 tools/ppc-linux-gnu418 tools/ppc64-linux-gnu419 tools/riscv64-unknown-linux-gnu420 tools/sparc64-linux-gnu421 tools/binutils-*.tar.bz2422 tools/gcc-*.tar.bz2423 tools/gdb-*.tar.gz424 tools/sycek/425 tools/downloads/ -
boot/Makefile.common
r5f36841 rdb9c889 217 217 $(USPACE_PATH)/app/untar/untar \ 218 218 $(USPACE_PATH)/app/usbinfo/usbinfo \ 219 $(USPACE_PATH)/app/vol/vol \ 219 220 $(USPACE_PATH)/app/vuhid/vuh \ 220 221 $(USPACE_PATH)/app/mkbd/mkbd \ -
uspace/Makefile
r5f36841 rdb9c889 79 79 app/untar \ 80 80 app/usbinfo \ 81 app/vol \ 81 82 app/vuhid \ 82 83 app/nic \ -
uspace/app/fdisk/fdisk.c
r5f36841 rdb9c889 37 37 #include <cap.h> 38 38 #include <errno.h> 39 #include <fdisk.h> 40 #include <io/label.h> 39 41 #include <nchoice.h> 40 42 #include <stdbool.h> 41 43 #include <stdio.h> 42 44 #include <stdlib.h> 43 #include <fdisk.h>44 45 #include <str.h> 46 #include <vol.h> 45 47 46 48 #define NO_LABEL_CAPTION "(No name)" … … 69 71 } devac_t; 70 72 71 static errno_t fdsk_pcnt_fs_format(vol_part_cnt_t pcnt, vol_fstype_t fstype,72 char **rstr)73 {74 errno_t rc;75 char *s;76 77 switch (pcnt) {78 case vpc_empty:79 s = str_dup("Empty");80 if (s == NULL)81 return ENOMEM;82 break;83 case vpc_fs:84 rc = fdisk_fstype_format(fstype, &s);85 if (rc != EOK)86 return ENOMEM;87 break;88 case vpc_unknown:89 s = str_dup("Unknown");90 if (s == NULL)91 return ENOMEM;92 break;93 }94 95 *rstr = s;96 return EOK;97 }98 99 73 /** Confirm user selection. */ 100 74 static errno_t fdsk_confirm(const char *msg, bool *rconfirm) … … 305 279 306 280 for (i = LT_FIRST; i < LT_LIMIT; i++) { 307 rc = fdisk_ltype_format(i, &sltype);281 rc = label_type_format(i, &sltype); 308 282 if (rc != EOK) 309 283 goto error; … … 413 387 414 388 for (i = 0; i < VOL_FSTYPE_LIMIT; i++) { 415 rc = fdisk_fstype_format(i, &sfstype);389 rc = vol_fstype_format(i, &sfstype); 416 390 if (rc != EOK) 417 391 goto error; … … 598 572 } 599 573 600 rc = fdisk_pkind_format(pinfo.pkind, &spkind);574 rc = label_pkind_format(pinfo.pkind, &spkind); 601 575 if (rc != EOK) { 602 576 printf("\nOut of memory.\n"); … … 605 579 606 580 if (pinfo.pkind != lpk_extended) { 607 rc = fdsk_pcnt_fs_format(pinfo.pcnt, pinfo.fstype, &sfstype);581 rc = vol_pcnt_fs_format(pinfo.pcnt, pinfo.fstype, &sfstype); 608 582 if (rc != EOK) { 609 583 printf("Out of memory.\n"); … … 773 747 break; 774 748 default: 775 rc = fdisk_ltype_format(linfo.ltype, &sltype);749 rc = label_type_format(linfo.ltype, &sltype); 776 750 if (rc != EOK) { 777 751 assert(rc == ENOMEM); … … 804 778 } 805 779 806 rc = fdsk_pcnt_fs_format(pinfo.pcnt, pinfo.fstype, &sfstype);780 rc = vol_pcnt_fs_format(pinfo.pcnt, pinfo.fstype, &sfstype); 807 781 if (rc != EOK) { 808 782 printf("Out of memory.\n"); … … 821 795 822 796 if ((linfo.flags & lf_ext_supp) != 0) { 823 rc = fdisk_pkind_format(pinfo.pkind, &spkind);797 rc = label_pkind_format(pinfo.pkind, &spkind); 824 798 if (rc != EOK) { 825 799 printf("\nOut of memory.\n"); -
uspace/lib/c/Makefile
r5f36841 rdb9c889 112 112 generic/io/log.c \ 113 113 generic/io/logctl.c \ 114 generic/io/label.c \ 114 115 generic/io/kio.c \ 115 116 generic/io/klog.c \ -
uspace/lib/c/generic/vol.c
r5f36841 rdb9c889 304 304 } 305 305 306 /** Format file system type as string. 307 * 308 * @param fstype File system type 309 * @param rstr Place to store pointer to newly allocated string 310 * @return EOK on success, ENOMEM if out of memory 311 */ 312 errno_t vol_fstype_format(vol_fstype_t fstype, char **rstr) 313 { 314 const char *sfstype; 315 char *s; 316 317 sfstype = NULL; 318 switch (fstype) { 319 case fs_exfat: 320 sfstype = "ExFAT"; 321 break; 322 case fs_fat: 323 sfstype = "FAT"; 324 break; 325 case fs_minix: 326 sfstype = "MINIX"; 327 break; 328 case fs_ext4: 329 sfstype = "Ext4"; 330 break; 331 case fs_cdfs: 332 sfstype = "ISO 9660"; 333 break; 334 } 335 336 s = str_dup(sfstype); 337 if (s == NULL) 338 return ENOMEM; 339 340 *rstr = s; 341 return EOK; 342 } 343 344 /** Format partition content / file system type as string. 345 * 346 * @param pcnt Partition content 347 * @param fstype File system type 348 * @param rstr Place to store pointer to newly allocated string 349 * @return EOK on success, ENOMEM if out of memory 350 */ 351 errno_t vol_pcnt_fs_format(vol_part_cnt_t pcnt, vol_fstype_t fstype, 352 char **rstr) 353 { 354 int rc; 355 char *s = NULL; 356 357 switch (pcnt) { 358 case vpc_empty: 359 s = str_dup("Empty"); 360 if (s == NULL) 361 return ENOMEM; 362 break; 363 case vpc_fs: 364 rc = vol_fstype_format(fstype, &s); 365 if (rc != EOK) 366 return ENOMEM; 367 break; 368 case vpc_unknown: 369 s = str_dup("Unknown"); 370 if (s == NULL) 371 return ENOMEM; 372 break; 373 } 374 375 assert(s != NULL); 376 *rstr = s; 377 return EOK; 378 } 379 306 380 /** @} 307 381 */ -
uspace/lib/c/include/types/vol.h
r5f36841 rdb9c889 37 37 38 38 #include <async.h> 39 #include <ipc/vfs.h> 39 40 #include <ipc/vol.h> 40 41 #include <stdbool.h> … … 75 76 /** Volume label */ 76 77 char label[VOL_LABEL_MAXLEN + 1]; 78 /** Current mount point */ 79 char cur_mp[MAX_PATH_LEN + 1]; /* XXX too big */ 80 /** Current mount point is automatic */ 81 bool cur_mp_auto; 77 82 } vol_part_info_t; 78 83 -
uspace/lib/c/include/vol.h
r5f36841 rdb9c889 37 37 38 38 #include <async.h> 39 #include <errno.h> 39 40 #include <loc.h> 40 41 #include <stdint.h> … … 47 48 extern errno_t vol_part_add(vol_t *, service_id_t); 48 49 extern errno_t vol_part_info(vol_t *, service_id_t, vol_part_info_t *); 50 extern errno_t vol_part_eject(vol_t *, service_id_t); 49 51 extern errno_t vol_part_empty(vol_t *, service_id_t); 50 52 extern errno_t vol_part_get_lsupp(vol_t *, vol_fstype_t, vol_label_supp_t *); 51 53 extern errno_t vol_part_mkfs(vol_t *, service_id_t, vol_fstype_t, const char *); 54 55 extern errno_t vol_fstype_format(vol_fstype_t, char **); 56 extern errno_t vol_pcnt_fs_format(vol_part_cnt_t, vol_fstype_t, char **); 52 57 53 58 #endif -
uspace/lib/fdisk/include/fdisk.h
r5f36841 rdb9c889 37 37 #define LIBFDISK_FDISK_H_ 38 38 39 #include <errno.h> 39 40 #include <loc.h> 40 41 #include <types/fdisk.h> … … 72 73 extern void fdisk_pspec_init(fdisk_part_spec_t *); 73 74 74 extern errno_t fdisk_ltype_format(label_type_t, char **);75 extern errno_t fdisk_fstype_format(vol_fstype_t, char **);76 extern errno_t fdisk_pkind_format(label_pkind_t, char **);77 78 75 extern errno_t fdisk_get_vollabel_support(fdisk_dev_t *, vol_fstype_t, 79 76 vol_label_supp_t *); -
uspace/lib/fdisk/src/fdisk.c
r5f36841 rdb9c889 813 813 } 814 814 815 errno_t fdisk_ltype_format(label_type_t ltype, char **rstr)816 {817 const char *sltype;818 char *s;819 820 sltype = NULL;821 switch (ltype) {822 case lt_none:823 sltype = "None";824 break;825 case lt_mbr:826 sltype = "MBR";827 break;828 case lt_gpt:829 sltype = "GPT";830 break;831 }832 833 s = str_dup(sltype);834 if (s == NULL)835 return ENOMEM;836 837 *rstr = s;838 return EOK;839 }840 841 errno_t fdisk_fstype_format(vol_fstype_t fstype, char **rstr)842 {843 const char *sfstype;844 char *s;845 846 sfstype = NULL;847 switch (fstype) {848 case fs_exfat:849 sfstype = "ExFAT";850 break;851 case fs_fat:852 sfstype = "FAT";853 break;854 case fs_minix:855 sfstype = "MINIX";856 break;857 case fs_ext4:858 sfstype = "Ext4";859 break;860 case fs_cdfs:861 sfstype = "ISO 9660";862 break;863 }864 865 s = str_dup(sfstype);866 if (s == NULL)867 return ENOMEM;868 869 *rstr = s;870 return EOK;871 }872 873 errno_t fdisk_pkind_format(label_pkind_t pkind, char **rstr)874 {875 const char *spkind;876 char *s;877 878 spkind = NULL;879 switch (pkind) {880 case lpk_primary:881 spkind = "Primary";882 break;883 case lpk_extended:884 spkind = "Extended";885 break;886 case lpk_logical:887 spkind = "Logical";888 break;889 }890 891 s = str_dup(spkind);892 if (s == NULL)893 return ENOMEM;894 895 *rstr = s;896 return EOK;897 }898 899 815 /** Get free partition index. */ 900 816 static errno_t fdisk_part_get_free_idx(fdisk_dev_t *dev, int *rindex) -
uspace/srv/volsrv/part.c
r5f36841 rdb9c889 155 155 return; 156 156 157 free(part->cur_mp); 157 158 free(part->svc_name); 158 159 free(part); … … 219 220 } 220 221 221 static int vol_part_mount(vol_part_t *part)222 static errno_t vol_part_mount(vol_part_t *part) 222 223 { 223 224 char *mp; 224 int rc; 225 int err; 226 errno_t rc; 225 227 226 228 if (str_size(part->label) < 1) { … … 231 233 232 234 log_msg(LOG_DEFAULT, LVL_NOTE, "Determine MP label='%s'", part->label); 233 rc= asprintf(&mp, "/vol/%s", part->label);234 if ( rc< 0) {235 log_msg(LOG_DEFAULT, LVL_ NOTE, "rc -> %d", rc);235 err = asprintf(&mp, "/vol/%s", part->label); 236 if (err < 0) { 237 log_msg(LOG_DEFAULT, LVL_ERROR, "Out of memory"); 236 238 return ENOMEM; 237 239 } … … 255 257 log_msg(LOG_DEFAULT, LVL_NOTE, "Mount to %s -> %d\n", mp, rc); 256 258 257 free(mp); 259 part->cur_mp = mp; 260 part->cur_mp_auto = true; 261 258 262 return rc; 259 263 } … … 381 385 382 386 return ENOENT; 387 } 388 389 errno_t vol_part_eject_part(vol_part_t *part) 390 { 391 int rc; 392 393 log_msg(LOG_DEFAULT, LVL_DEBUG, "vol_part_eject_part()"); 394 395 if (part->cur_mp == NULL) { 396 log_msg(LOG_DEFAULT, LVL_DEBUG, "Attempt to mount unmounted " 397 "partition."); 398 return EINVAL; 399 } 400 401 rc = vfs_unmount_path(part->cur_mp); 402 if (rc != EOK) { 403 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed unmounting partition " 404 "from %s", part->cur_mp); 405 return rc; 406 } 407 408 if (part->cur_mp_auto) { 409 rc = vfs_unlink_path(part->cur_mp); 410 if (rc != EOK) { 411 log_msg(LOG_DEFAULT, LVL_ERROR, "Failed deleting " 412 "mount directory %s.", part->cur_mp); 413 } 414 } 415 416 free(part->cur_mp); 417 part->cur_mp = NULL; 418 part->cur_mp_auto = false; 419 420 return EOK; 383 421 } 384 422 … … 443 481 pinfo->fstype = part->fstype; 444 482 str_cpy(pinfo->label, sizeof(pinfo->label), part->label); 483 str_cpy(pinfo->cur_mp, sizeof(pinfo->cur_mp), part->cur_mp); 484 pinfo->cur_mp_auto = part->cur_mp_auto; 445 485 return EOK; 446 486 } -
uspace/srv/volsrv/part.h
r5f36841 rdb9c889 48 48 extern errno_t vol_part_get_ids(service_id_t *, size_t, size_t *); 49 49 extern errno_t vol_part_find_by_id(service_id_t, vol_part_t **); 50 extern errno_t vol_part_eject_part(vol_part_t *); 50 51 extern errno_t vol_part_empty_part(vol_part_t *); 51 52 extern errno_t vol_part_mkfs_part(vol_part_t *, vol_fstype_t, const char *); -
uspace/srv/volsrv/types/part.h
r5f36841 rdb9c889 39 39 40 40 #include <adt/list.h> 41 #include <stdbool.h> 41 42 #include <types/label.h> 42 43 … … 55 56 /** Volume label */ 56 57 char *label; 58 /** Where volume is currently mounted */ 59 char *cur_mp; 60 /** Mounted at automatic mount point */ 61 bool cur_mp_auto; 57 62 } vol_part_t; 58 63
Note:
See TracChangeset
for help on using the changeset viewer.