END_TEST static void test_manifest_tell_seek(enum protocol protocol, int phase) { struct slist *slist; struct manio *manio; struct sbuf *sb=NULL; man_off_t *offset=NULL; int entries=1000; prng_init(0); base64_init(); hexmap_init(); recursive_delete(path); slist=build_manifest(path, protocol, entries, phase); fail_unless(slist!=NULL); sb=slist->head; fail_unless((manio=do_manio_open(path, "rb", protocol, phase))!=NULL); read_manifest(&sb, manio, 0, entries/2, protocol, phase); fail_unless((offset=manio_tell(manio))!=NULL); fail_unless(sb!=NULL); fail_unless(!manio_close(&manio)); fail_unless((manio=do_manio_open(path, "rb", protocol, phase))!=NULL); fail_unless(!manio_seek(manio, offset)); read_manifest(&sb, manio, entries/2, entries, protocol, phase); fail_unless(sb==NULL); fail_unless(!manio_close(&manio)); fail_unless(!manio); slist_free(&slist); man_off_t_free(&offset); tear_down(); }
struct manio *manio_open_phase3(const char *manifest, const char *mode, enum protocol protocol, const char *rmanifest) { struct manio *manio=NULL; if(!(manio=do_manio_open(manifest, mode, protocol, 3))) goto end; if(protocol==PROTO_2 && rmanifest) { char *hooksdir=NULL; char *dindexdir=NULL; if(!(hooksdir=prepend_s(manifest, "hooks")) || !(dindexdir=prepend_s(manifest, "dindex")) || init_write_hooks(manio, hooksdir, rmanifest) || init_write_dindex(manio, dindexdir)) manio_close(&manio); free_w(&hooksdir); free_w(&dindexdir); } end: return manio; }
struct manio *manio_open_phase2(const char *manifest, const char *mode, enum protocol protocol) { return do_manio_open(manifest, mode, protocol, 2); }