commit c3434cef3dd7dbd62000d244d716b997f98226a5 from: Omar Polo date: Fri Jul 12 12:58:40 2024 UTC add an algo field to struct got_pack Future work on sha256 will need the current hashing algorithm at hand. ok tobhe@, stsp@ commit - 020f73dba5df9e319726af7526dbb3b478d52b76 commit + c3434cef3dd7dbd62000d244d716b997f98226a5 blob - 08acf40b3e797365f5cc41914e99e091f0f09fe7 blob + 1b9a3c7d50834fc34fcac7ff7919ea96d024bf44 --- lib/got_lib_pack.h +++ lib/got_lib_pack.h @@ -24,6 +24,7 @@ struct got_pack_privsep_child { struct got_pack { char *path_packfile; int fd; + enum got_hash_algorithm algo; uint8_t *map; off_t filesize; struct got_pack_privsep_child *privsep_child; blob - b643ffc4d3b4304f1d21cd0eeb70e6170a63554e blob + a17be0408a103339d10ae1a1e9736deb19fb0b74 --- lib/got_lib_privsep.h +++ lib/got_lib_privsep.h @@ -520,6 +520,7 @@ struct got_imsg_packidx { struct got_imsg_pack { char path_packfile[PATH_MAX]; off_t filesize; + int algo; /* Additionally, a file desciptor is passed via imsg. */ } __attribute__((__packed__)); blob - 7e62208eb4b4a54c4cea9971137def3815fabedf blob + 1edd0153662b01a8fd962579a4b5a7c5af42df69 --- lib/privsep.c +++ lib/privsep.c @@ -1975,6 +1975,7 @@ got_privsep_init_pack_child(struct imsgbuf *ibuf, stru sizeof(ipack.path_packfile)) >= sizeof(ipack.path_packfile)) return got_error(GOT_ERR_NO_SPACE); ipack.filesize = pack->filesize; + ipack.algo = pack->algo; fd = dup(pack->fd); if (fd == -1) blob - 271a0e86825dde1ffd9062349f1b0ff19c086697 blob + 7323331c86c9085cb6ec9fdad463a7ff32f92518 --- lib/repository.c +++ lib/repository.c @@ -1609,6 +1609,7 @@ got_repo_cache_pack(struct got_pack **packp, struct go goto done; } pack->filesize = sb.st_size; + pack->algo = repo->algo; pack->privsep_child = NULL; blob - 1a3634ab2fe9a44827da4a6597ff3582c37a42f3 blob + aec894fa8b4604174f7faf23446d66e16ac0d570 --- libexec/got-read-pack/got-read-pack.c +++ libexec/got-read-pack/got-read-pack.c @@ -1880,6 +1880,7 @@ receive_pack(struct got_pack **packp, struct imsgbuf * } memcpy(&ipack, imsg.data, sizeof(ipack)); + pack->algo = ipack.algo; pack->filesize = ipack.filesize; pack->fd = imsg_get_fd(&imsg); if (pack->fd == -1) {