Lines Matching full:pkg

49 	.fs_name = "pkg",
162 struct package *pkg; in pkgfs_init() local
165 pkg = NULL; in pkgfs_init()
178 error = new_package(fd, &pkg); in pkgfs_init()
184 if (pkg == NULL) in pkgfs_init()
187 pkg->pkg_chain = package; in pkgfs_init()
188 package = pkg; in pkgfs_init()
218 * at the first filename that has the .pkg extension. This is in pkg_open_follow()
446 get_byte(struct package *pkg, off_t *op) in get_byte() argument
450 if (pkg->pkg_zs.avail_in == 0) { in get_byte()
451 c = read(pkg->pkg_fd, pkg->pkg_buf, PKG_BUFSIZE); in get_byte()
454 pkg->pkg_zs.avail_in = c; in get_byte()
455 pkg->pkg_zs.next_in = pkg->pkg_buf; in get_byte()
458 c = *pkg->pkg_zs.next_in; in get_byte()
459 pkg->pkg_zs.next_in++; in get_byte()
460 pkg->pkg_zs.avail_in--; in get_byte()
466 get_zipped(struct package *pkg, void *buf, size_t bufsz) in get_zipped() argument
470 pkg->pkg_zs.next_out = buf; in get_zipped()
471 pkg->pkg_zs.avail_out = bufsz; in get_zipped()
473 while (pkg->pkg_zs.avail_out) { in get_zipped()
474 if (pkg->pkg_zs.avail_in == 0) { in get_zipped()
475 c = read(pkg->pkg_fd, pkg->pkg_buf, PKG_BUFSIZE); in get_zipped()
480 pkg->pkg_zs.avail_in = c; in get_zipped()
481 pkg->pkg_zs.next_in = pkg->pkg_buf; in get_zipped()
484 c = inflate(&pkg->pkg_zs, Z_SYNC_FLUSH); in get_zipped()
491 pkg->pkg_ofs += bufsz; in get_zipped()
510 struct package *pkg; in cache_data() local
519 pkg = tf->tf_pkg; in cache_data()
520 if (pkg == NULL) { in cache_data()
532 if (tf->tf_ofs != pkg->pkg_ofs) { in cache_data()
557 return (get_zipped(pkg, tf->tf_cache, sz)); in cache_data()
636 * Technically, GNU pkg considers a field to be in base-256 in pkg_atol()
661 struct package *pkg; in new_package() local
665 pkg = malloc(sizeof(*pkg)); in new_package()
666 if (pkg == NULL) in new_package()
669 bzero(pkg, sizeof(*pkg)); in new_package()
670 pkg->pkg_fd = fd; in new_package()
679 if (get_byte(pkg, &ofs) != 0x1f || get_byte(pkg, &ofs) != 0x8b) in new_package()
682 if (get_byte(pkg, &ofs) != Z_DEFLATED) in new_package()
685 flags = get_byte(pkg, &ofs); in new_package()
691 if (get_byte(pkg, &ofs) == -1) in new_package()
697 i = (get_byte(pkg, &ofs) & 0xff) | in new_package()
698 ((get_byte(pkg, &ofs) << 8) & 0xff); in new_package()
700 if (get_byte(pkg, &ofs) == -1) in new_package()
708 i = get_byte(pkg, &ofs); in new_package()
717 i = get_byte(pkg, &ofs); in new_package()
728 if (get_byte(pkg, &ofs) == -1) in new_package()
730 if (get_byte(pkg, &ofs) == -1) in new_package()
737 error = inflateInit2(&pkg->pkg_zs, -15); in new_package()
741 *pp = pkg; in new_package()
745 free(pkg); in new_package()
750 scan_tarfile(struct package *pkg, struct tarfile *last) in scan_tarfile() argument
757 cur = (last != NULL) ? last->tf_next : pkg->pkg_first; in scan_tarfile()
760 pkg->pkg_ofs; in scan_tarfile()
764 if (ofs < pkg->pkg_ofs) { in scan_tarfile()
769 if (ofs != pkg->pkg_ofs) { in scan_tarfile()
770 if (last != NULL && pkg->pkg_ofs == last->tf_ofs) { in scan_tarfile()
774 sz = ofs - pkg->pkg_ofs; in scan_tarfile()
778 if (get_zipped(pkg, buf, sz) == -1) in scan_tarfile()
780 sz = ofs - pkg->pkg_ofs; in scan_tarfile()
789 cur->tf_pkg = pkg; in scan_tarfile()
792 if (get_zipped(pkg, &cur->tf_hdr, in scan_tarfile()
800 * a PKG. It marks the end of the archive. in scan_tarfile()
808 cur->tf_ofs = pkg->pkg_ofs; in scan_tarfile()
820 while (pkg->pkg_ofs < ofs) { in scan_tarfile()
821 if (get_zipped(pkg, buf, sizeof(buf)) == -1) { in scan_tarfile()
831 pkg->pkg_first = cur; in scan_tarfile()
832 pkg->pkg_last = cur; in scan_tarfile()