mirror of
https://github.com/urbit/shrub.git
synced 2025-01-03 10:02:32 +03:00
Coherent boot without -A.
Only works with pills generated by the `coherent` arvo branch.
This commit is contained in:
parent
83d0f88710
commit
1852393bc4
@ -614,7 +614,6 @@
|
||||
c3_c* who_c; // -w, begin with ticket
|
||||
c3_c* tic_c; // -t, ticket value
|
||||
c3_c* pil_c; // -B, bootstrap from
|
||||
c3_c* arv_c; // -A, initial sync from
|
||||
c3_c* lit_c; // -J, ivory (fastboot) kernel
|
||||
c3_c* gen_c; // -G, czar generator
|
||||
c3_w kno_w; // -k, kernel version
|
||||
@ -721,7 +720,6 @@
|
||||
typedef struct _u3_pier {
|
||||
c3_c* pax_c; // pier directory
|
||||
c3_c* sys_c; // pill file
|
||||
c3_c* arv_c; // arvo directory
|
||||
c3_d gen_d; // last event discovered
|
||||
c3_d but_d; // boot barrier
|
||||
c3_d key_d[4]; // save and passkey
|
||||
|
20
vere/main.c
20
vere/main.c
@ -81,7 +81,7 @@ _main_getopt(c3_i argc, c3_c** argv)
|
||||
u3_Host.ops_u.rep = c3n;
|
||||
u3_Host.ops_u.kno_w = DefaultKernel;
|
||||
|
||||
while ( (ch_i=getopt(argc, argv,"G:B:A:I:w:t:f:k:l:n:p:r:LabcdgmqvxFMPDXR")) != -1 ) {
|
||||
while ( (ch_i=getopt(argc, argv,"G:B:I:w:t:f:k:l:n:p:r:LabcdgmqvxFMPDXR")) != -1 ) {
|
||||
switch ( ch_i ) {
|
||||
case 'M': {
|
||||
u3_Host.ops_u.mem = c3y;
|
||||
@ -95,10 +95,6 @@ _main_getopt(c3_i argc, c3_c** argv)
|
||||
u3_Host.ops_u.gen_c = strdup(optarg);
|
||||
break;
|
||||
}
|
||||
case 'A': {
|
||||
u3_Host.ops_u.arv_c = strdup(optarg);
|
||||
break;
|
||||
}
|
||||
case 'I': {
|
||||
u3_Host.ops_u.imp_c = _main_presig(optarg);
|
||||
break;
|
||||
@ -185,20 +181,6 @@ _main_getopt(c3_i argc, c3_c** argv)
|
||||
exit(1); /* (avoid simple usage msg) */
|
||||
}
|
||||
|
||||
if ( u3_Host.ops_u.arv_c != 0 && ( u3_Host.ops_u.imp_c == 0 ||
|
||||
u3_Host.ops_u.nuu == c3n ) ) {
|
||||
fprintf(stderr, "-A only makes sense when creating a new galaxy\n");
|
||||
return c3n;
|
||||
}
|
||||
|
||||
if ( u3_Host.ops_u.imp_c != 0 &&
|
||||
u3_Host.ops_u.arv_c == 0 &&
|
||||
u3_Host.ops_u.nuu == c3y ) {
|
||||
fprintf(stderr, "can't create a new galaxy without specifying "
|
||||
"the initial sync path with -A\n");
|
||||
return c3n;
|
||||
}
|
||||
|
||||
if ( u3_Host.ops_u.gen_c != 0 && ( u3_Host.ops_u.imp_c == 0 ||
|
||||
u3_Host.ops_u.nuu == c3n ) ) {
|
||||
fprintf(stderr, "-G only makes sense when creating a new galaxy\n");
|
||||
|
35
vere/pier.c
35
vere/pier.c
@ -250,7 +250,7 @@ _pier_disk_precommit_replace(u3_writ* wit_u)
|
||||
/* otherwise, decrement the precommit request counter.
|
||||
** the returning request will notice this and rerequest.
|
||||
*/
|
||||
// fprintf(stderr, "pier: (%lld): precommit: replace\r\n", wit_u->evt_d);
|
||||
fprintf(stderr, "pier: (%lld): precommit: replace\r\n", wit_u->evt_d);
|
||||
|
||||
c3_assert(wit_u->evt_d == log_u->rep_d);
|
||||
log_u->rep_d -= 1ULL;
|
||||
@ -1131,6 +1131,11 @@ _pier_work_poke(void* vod_p,
|
||||
if ( !wit_u || (mug_l && (mug_l != wit_u->mug_l)) ) {
|
||||
goto error;
|
||||
}
|
||||
{
|
||||
// XX not the right place to print an error!
|
||||
//
|
||||
u3_pier_punt(0, u3k(u3t(u3t(u3t(r_jar)))));
|
||||
}
|
||||
_pier_work_replace(wit_u, u3k(r_jar), mat);
|
||||
}
|
||||
break;
|
||||
@ -1262,9 +1267,6 @@ u3_pier_create(c3_c* pax_c, c3_c* sys_c)
|
||||
pir_u->sys_c = c3_malloc(1 + strlen(sys_c));
|
||||
strcpy(pir_u->sys_c, sys_c);
|
||||
|
||||
pir_u->arv_c = c3_malloc(1 + strlen(u3_Host.ops_u.arv_c)); /* parametrize */
|
||||
strcpy(pir_u->arv_c, u3_Host.ops_u.arv_c);
|
||||
|
||||
pir_u->gen_d = 0;
|
||||
pir_u->key_d[0] = pir_u->key_d[1] = pir_u->key_d[2] = pir_u->key_d[3] = 0;
|
||||
|
||||
@ -1388,6 +1390,7 @@ u3_pier_rand(c3_w* rad_w)
|
||||
close(fid_i);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* _pier_zen(): get OS entropy.
|
||||
*/
|
||||
static u3_noun
|
||||
@ -1398,6 +1401,7 @@ _pier_zen()
|
||||
c3_rand(rad_w);
|
||||
return u3i_words(16, rad_w);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* _pier_loop_init(): initialize loop handlers.
|
||||
*/
|
||||
@ -1473,6 +1477,7 @@ _pier_loop_wake(u3_pier* pir_u)
|
||||
|
||||
/* _pier_loop_exit(): terminate I/O across the process.
|
||||
*/
|
||||
#if 0
|
||||
static void
|
||||
_pier_loop_exit(void)
|
||||
{
|
||||
@ -1506,6 +1511,7 @@ _pier_loop_exit(void)
|
||||
u3_behn_io_exit(u3_pier_stub());
|
||||
u3a_lop(cod_l);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* _pier_loop_poll(): update listeners.
|
||||
*/
|
||||
@ -1550,6 +1556,7 @@ _pier_loop_time(void)
|
||||
u3v_time(u3_time_in_tv(&tim_tv));
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* _pier_boot_seed(): build the cryptographic seed noun.
|
||||
*/
|
||||
static u3_noun
|
||||
@ -1585,6 +1592,7 @@ _pier_boot_seed(u3_pier* pir_u)
|
||||
u3z(imp);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* _pier_boot_legacy(): poorly organized legacy boot calls.
|
||||
@ -1645,24 +1653,6 @@ _pier_boot_complete(u3_pier* pir_u,
|
||||
|
||||
_pier_work_save(pir_u);
|
||||
|
||||
#if 0
|
||||
_pier_boot_legacy(pir_u, nuu_o);
|
||||
#else
|
||||
/* an anomaly that the true sequence will eliminate
|
||||
*/
|
||||
{
|
||||
if ( c3y == nuu_o ) {
|
||||
u3_noun pig = _pier_boot_seed(pir_u);
|
||||
u3_noun pax = u3nq(u3_blip, c3__term, '1', u3_nul);
|
||||
|
||||
u3_pier_plan(pax, u3nc(c3__boot, pig));
|
||||
|
||||
/* another anomaly
|
||||
*/
|
||||
u3_unix_ef_boot(pir_u);
|
||||
}
|
||||
}
|
||||
|
||||
/* the main course
|
||||
*/
|
||||
_pier_loop_wake(pir_u);
|
||||
@ -1674,7 +1664,6 @@ _pier_boot_complete(u3_pier* pir_u,
|
||||
u3_term_ef_verb();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* _pier_loop_prepare():
|
||||
|
131
vere/unix.c
131
vere/unix.c
@ -876,122 +876,6 @@ _unix_update_mount(u3_pier *pir_u, u3_umon* mon_u, u3_noun all)
|
||||
}
|
||||
}
|
||||
|
||||
/* _unix_initial_update_file(): read file, but don't watch
|
||||
*/
|
||||
static u3_noun
|
||||
_unix_initial_update_file(u3_pier *pir_u, c3_c* pax_c)
|
||||
{
|
||||
struct stat buf_u;
|
||||
c3_i fid_i = open(pax_c, O_RDONLY, 0644);
|
||||
c3_ws len_ws, red_ws;
|
||||
c3_y* dat_y;
|
||||
|
||||
if ( fid_i < 0 || fstat(fid_i, &buf_u) < 0 ) {
|
||||
if ( ENOENT == errno ) {
|
||||
return u3_nul;
|
||||
}
|
||||
else {
|
||||
uL(fprintf(uH, "error opening initial file %s: %s\r\n",
|
||||
pax_c, strerror(errno)));
|
||||
return u3_nul;
|
||||
}
|
||||
}
|
||||
|
||||
len_ws = buf_u.st_size;
|
||||
dat_y = c3_malloc(len_ws);
|
||||
|
||||
red_ws = read(fid_i, dat_y, len_ws);
|
||||
|
||||
if ( close(fid_i) < 0 ) {
|
||||
uL(fprintf(uH, "error closing initial file %s: %s\r\n",
|
||||
pax_c, strerror(errno)));
|
||||
}
|
||||
|
||||
if ( len_ws != red_ws ) {
|
||||
if ( red_ws < 0 ) {
|
||||
uL(fprintf(uH, "error reading initial file %s: %s\r\n",
|
||||
pax_c, strerror(errno)));
|
||||
}
|
||||
else {
|
||||
uL(fprintf(uH, "wrong # of bytes read in initial file %s: %d %d\r\n",
|
||||
pax_c, len_ws, red_ws));
|
||||
}
|
||||
free(dat_y);
|
||||
return u3_nul;
|
||||
}
|
||||
else {
|
||||
u3_noun pax = _unix_string_to_path_helper(pax_c
|
||||
+ strlen(pir_u->arv_c)
|
||||
+ 1); /* XX slightly less VERY BAD than before*/
|
||||
u3_noun mim = u3nt(c3__text, u3i_string("plain"), u3_nul);
|
||||
u3_noun dat = u3nt(mim, len_ws, u3i_bytes(len_ws, dat_y));
|
||||
|
||||
free(dat_y);
|
||||
return u3nc(u3nt(pax, u3_nul, dat), u3_nul);
|
||||
}
|
||||
}
|
||||
|
||||
/* _unix_initial_update_dir(): read directory, but don't watch
|
||||
*/
|
||||
static u3_noun
|
||||
_unix_initial_update_dir(u3_pier *pir_u, c3_c* pax_c)
|
||||
{
|
||||
u3_noun can = u3_nul;
|
||||
|
||||
DIR* rid_u = opendir(pax_c);
|
||||
if ( !rid_u ) {
|
||||
uL(fprintf(uH, "error opening initial directory: %s: %s\r\n",
|
||||
pax_c, strerror(errno)));
|
||||
return u3_nul;
|
||||
}
|
||||
|
||||
while ( 1 ) {
|
||||
struct dirent ent_u;
|
||||
struct dirent* out_u;
|
||||
c3_w err_w;
|
||||
|
||||
if ( 0 != (err_w = readdir_r(rid_u, &ent_u, &out_u)) ) {
|
||||
uL(fprintf(uH, "error loading initial directory %s: %s\r\n",
|
||||
pax_c, strerror(errno)));
|
||||
c3_assert(0);
|
||||
}
|
||||
else if ( !out_u ) {
|
||||
break;
|
||||
}
|
||||
else if ( '.' == out_u->d_name[0] ) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
c3_c* pox_c = _unix_down(pax_c, out_u->d_name);
|
||||
|
||||
struct stat buf_u;
|
||||
|
||||
if ( 0 != stat(pox_c, &buf_u) ) {
|
||||
uL(fprintf(uH, "initial can't stat %s: %s\r\n",
|
||||
pox_c, strerror(errno)));
|
||||
free(pox_c);
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
if ( S_ISDIR(buf_u.st_mode) ) {
|
||||
can = u3kb_weld(_unix_initial_update_dir(pir_u, pox_c), can);
|
||||
}
|
||||
else {
|
||||
can = u3kb_weld(_unix_initial_update_file(pir_u, pox_c), can);
|
||||
}
|
||||
free(pox_c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( closedir(rid_u) < 0 ) {
|
||||
uL(fprintf(uH, "error closing initial directory %s: %s\r\n",
|
||||
pax_c, strerror(errno)));
|
||||
}
|
||||
|
||||
return can;
|
||||
}
|
||||
|
||||
/* _unix_sign_cb: signal callback.
|
||||
*/
|
||||
static void
|
||||
@ -1306,7 +1190,6 @@ u3_unix_ef_bake(u3_pier *pir_u)
|
||||
u3_pier_work(pir_u,
|
||||
u3nt(u3_blip, c3__boat, u3_nul),
|
||||
u3nc(c3__boat, u3_nul));
|
||||
|
||||
}
|
||||
|
||||
/* u3_unix_ef_move()
|
||||
@ -1321,20 +1204,6 @@ u3_unix_ef_move(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* u3_unix_ef_boot(): boot actions
|
||||
*/
|
||||
void
|
||||
u3_unix_ef_boot(u3_pier *pir_u)
|
||||
{
|
||||
if ( u3_Host.ops_u.imp_c ) {
|
||||
u3_noun can = _unix_initial_update_dir(pir_u, pir_u->arv_c);
|
||||
|
||||
u3_pier_work(pir_u,
|
||||
u3nq(u3_blip, c3__sync, u3k(u3A->sen), u3_nul),
|
||||
u3nq(c3__into, u3_nul, c3y, can));
|
||||
}
|
||||
}
|
||||
|
||||
/* u3_unix_ef_look(): update the root.
|
||||
*/
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user