Lines Matching refs:err

337 	int err, opened;  in vhd_util_check_footer()  local
345 err = posix_memalign((void **)&buf, VHD_SECTOR_SIZE, sizeof(primary)); in vhd_util_check_footer()
346 if (err) { in vhd_util_check_footer()
347 printf("error allocating buffer: %d\n", err); in vhd_util_check_footer()
348 return -err; in vhd_util_check_footer()
355 err = -errno; in vhd_util_check_footer()
356 printf("error calculating end of file: %d\n", err); in vhd_util_check_footer()
363 err = -errno; in vhd_util_check_footer()
364 printf("error calculating end of file: %d\n", err); in vhd_util_check_footer()
368 err = read(fd, buf, 512); in vhd_util_check_footer()
369 if (err != size) { in vhd_util_check_footer()
370 err = (errno ? -errno : -EIO); in vhd_util_check_footer()
371 printf("error reading primary footer: %d\n", err); in vhd_util_check_footer()
384 err = -EINVAL; in vhd_util_check_footer()
390 err = 0; in vhd_util_check_footer()
397 err = -errno; in vhd_util_check_footer()
398 printf("error seeking to backup footer: %d\n", err); in vhd_util_check_footer()
405 err = read(fd, buf, size); in vhd_util_check_footer()
406 if (err != size) { in vhd_util_check_footer()
407 err = (errno ? -errno : -EIO); in vhd_util_check_footer()
408 printf("error reading backup footer: %d\n", err); in vhd_util_check_footer()
417 err = -EINVAL; in vhd_util_check_footer()
440 err = -EINVAL; in vhd_util_check_footer()
446 err = 0; in vhd_util_check_footer()
451 return err; in vhd_util_check_footer()
457 int err; in vhd_util_check_header() local
462 err = posix_memalign((void **)&buf, VHD_SECTOR_SIZE, sizeof(header)); in vhd_util_check_header()
463 if (err) { in vhd_util_check_header()
464 printf("error allocating header: %d\n", err); in vhd_util_check_header()
465 return err; in vhd_util_check_header()
471 err = -errno; in vhd_util_check_header()
472 printf("error seeking to header: %d\n", err); in vhd_util_check_header()
476 err = read(fd, buf, sizeof(header)); in vhd_util_check_header()
477 if (err != sizeof(header)) { in vhd_util_check_header()
478 err = (errno ? -errno : -EIO); in vhd_util_check_header()
479 printf("error reading header: %d\n", err); in vhd_util_check_header()
488 err = -EINVAL; in vhd_util_check_header()
493 err = 0; in vhd_util_check_header()
497 return err; in vhd_util_check_header()
518 int i, j, err, block_size; in vhd_util_check_bat() local
520 err = vhd_seek(vhd, 0, SEEK_END); in vhd_util_check_bat()
521 if (err) { in vhd_util_check_bat()
522 printf("error calculating eof: %d\n", err); in vhd_util_check_bat()
523 return err; in vhd_util_check_bat()
542 err = vhd_get_bat(vhd); in vhd_util_check_bat()
543 if (err) { in vhd_util_check_bat()
544 printf("error reading bat: %d\n", err); in vhd_util_check_bat()
545 return err; in vhd_util_check_bat()
548 err = vhd_end_of_headers(vhd, &eoh); in vhd_util_check_bat()
549 if (err) { in vhd_util_check_bat()
550 printf("error calculating end of metadata: %d\n", err); in vhd_util_check_bat()
551 return err; in vhd_util_check_bat()
586 err = -EINVAL; in vhd_util_check_bat()
589 err = -EINVAL; in vhd_util_check_bat()
593 err = -EINVAL; in vhd_util_check_bat()
595 if (err) { in vhd_util_check_bat()
599 return err; in vhd_util_check_bat()
611 int i, err; in vhd_util_check_batmap() local
613 err = vhd_get_bat(vhd); in vhd_util_check_batmap()
614 if (err) { in vhd_util_check_batmap()
615 printf("error reading bat: %d\n", err); in vhd_util_check_batmap()
616 return err; in vhd_util_check_batmap()
619 err = vhd_get_batmap(vhd); in vhd_util_check_batmap()
620 if (err) { in vhd_util_check_batmap()
621 printf("error reading batmap: %d\n", err); in vhd_util_check_batmap()
622 return err; in vhd_util_check_batmap()
647 int i, n, err; in vhd_util_check_parent_locators() local
664 err = vhd_header_decode_parent(vhd, &vhd->header, &pname); in vhd_util_check_parent_locators()
665 if (err) { in vhd_util_check_parent_locators()
666 printf("error decoding parent name: %d\n", err); in vhd_util_check_parent_locators()
667 return err; in vhd_util_check_parent_locators()
678 err = -EINVAL; in vhd_util_check_parent_locators()
718 err = -EINVAL; in vhd_util_check_parent_locators()
728 err = vhd_parent_locator_read(vhd, loc, &ppath); in vhd_util_check_parent_locators()
729 if (err) { in vhd_util_check_parent_locators()
730 printf("error reading parent locator %d: %d\n", i, err); in vhd_util_check_parent_locators()
736 err = -EINVAL; in vhd_util_check_parent_locators()
742 err = vhd_find_parent(vhd, ppath, &location); in vhd_util_check_parent_locators()
743 if (err) { in vhd_util_check_parent_locators()
744 printf("error resolving %s: %d\n", ppath, err); in vhd_util_check_parent_locators()
748 err = access(location, R_OK); in vhd_util_check_parent_locators()
749 if (err && loc->code == PLAT_CODE_MACX) { in vhd_util_check_parent_locators()
750 err = -errno; in vhd_util_check_parent_locators()
758 err = -EINVAL; in vhd_util_check_parent_locators()
774 err = -EINVAL; in vhd_util_check_parent_locators()
779 err = -EINVAL; in vhd_util_check_parent_locators()
784 err = 0; in vhd_util_check_parent_locators()
790 return err; in vhd_util_check_parent_locators()
806 int fd, err; in vhd_util_check_vhd() local
815 err = stat(name, &stats); in vhd_util_check_vhd()
816 if (err == -1) { in vhd_util_check_vhd()
832 err = vhd_util_check_footer(fd, &footer, ignore); in vhd_util_check_vhd()
833 if (err) in vhd_util_check_vhd()
839 err = vhd_util_check_header(fd, &footer); in vhd_util_check_vhd()
840 if (err) in vhd_util_check_vhd()
843 err = vhd_open(&vhd, name, VHD_OPEN_RDONLY | VHD_OPEN_IGNORE_DISABLED); in vhd_util_check_vhd()
844 if (err) in vhd_util_check_vhd()
847 err = vhd_util_check_differencing_header(&vhd); in vhd_util_check_vhd()
848 if (err) in vhd_util_check_vhd()
851 err = vhd_util_check_bat(&vhd); in vhd_util_check_vhd()
852 if (err) in vhd_util_check_vhd()
856 err = vhd_util_check_batmap(&vhd); in vhd_util_check_vhd()
857 if (err) in vhd_util_check_vhd()
862 err = vhd_util_check_parent_locators(&vhd); in vhd_util_check_vhd()
863 if (err) in vhd_util_check_vhd()
867 err = 0; in vhd_util_check_vhd()
871 if (err) in vhd_util_check_vhd()
876 return err; in vhd_util_check_vhd()
882 int err; in vhd_util_check_parents() local
889 err = vhd_open(&vhd, cur, in vhd_util_check_parents()
891 if (err) in vhd_util_check_parents()
899 err = vhd_parent_locator_get(&vhd, &parent); in vhd_util_check_parents()
902 if (err) { in vhd_util_check_parents()
903 printf("error getting parent: %d\n", err); in vhd_util_check_parents()
911 err = vhd_util_check_vhd(cur, ignore); in vhd_util_check_parents()
912 if (err) in vhd_util_check_parents()
917 if (err) in vhd_util_check_parents()
918 printf("error checking parents: %d\n", err); in vhd_util_check_parents()
921 return err; in vhd_util_check_parents()
929 int c, err, ignore, parents; in vhd_util_check() local
932 err = -EINVAL; in vhd_util_check()
953 err = 0; in vhd_util_check()
956 err = -EINVAL; in vhd_util_check()
962 err = -EINVAL; in vhd_util_check()
966 err = vhd_util_check_vhd(name, ignore); in vhd_util_check()
967 if (err) in vhd_util_check()
971 err = vhd_util_check_parents(name, ignore); in vhd_util_check()
974 return err; in vhd_util_check()
979 return err; in vhd_util_check()