From: Omar Polo Subject: add an algo field to got_pack To: gameoftrees@openbsd.org Date: Thu, 11 Jul 2024 16:03:16 +0200 this, and an upcoming diff to do the same with the packidx, will allow to avoid having to pass the algorithm around. Subsequent diff will need this. diff /home/op/w/got commit - 020f73dba5df9e319726af7526dbb3b478d52b76 path + /home/op/w/got blob - 08acf40b3e797365f5cc41914e99e091f0f09fe7 file + lib/got_lib_pack.h --- 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 file + lib/got_lib_privsep.h --- 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 file + lib/privsep.c --- 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 file + lib/repository.c --- 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 file + libexec/got-read-pack/got-read-pack.c --- 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) {