mirror of
https://github.com/urbit/shrub.git
synced 2024-12-17 07:14:52 +03:00
start in/out split
This commit is contained in:
parent
5e74c7286b
commit
a1ef36e02d
@ -294,7 +294,7 @@
|
||||
struct _u3_udir;
|
||||
struct _u3_ufil;
|
||||
|
||||
/* u3_unod: file or directory.
|
||||
/* u3_unod: in-file or in-directory.
|
||||
*/
|
||||
typedef struct _u3_unod {
|
||||
uv_fs_event_t was_u; // stat watcher
|
||||
@ -304,7 +304,7 @@
|
||||
struct _u3_udir* par_u; // in directory
|
||||
} u3_unod;
|
||||
|
||||
/* u3_ufil: synchronized file.
|
||||
/* u3_ufil: synchronized in-file.
|
||||
*/
|
||||
typedef struct _u3_ufil {
|
||||
uv_fs_event_t was_u; // stat watcher
|
||||
@ -317,7 +317,7 @@
|
||||
struct _u3_ufil* nex_u; // internal list
|
||||
} u3_ufil;
|
||||
|
||||
/* u3_udir: synchronized directory.
|
||||
/* u3_udir: synchronized in-directory.
|
||||
*/
|
||||
typedef struct _u3_udir {
|
||||
uv_fs_event_t was_u; // stat watcher
|
||||
@ -333,7 +333,8 @@
|
||||
/* u3_uhot: synchronized host.
|
||||
*/
|
||||
typedef struct _u3_uhot {
|
||||
u3_udir dir_u; // root directory
|
||||
u3_udir dir_u; // in directory
|
||||
c3_c* dot_u; // out directory
|
||||
c3_w who_w[4]; // owner as words
|
||||
struct _u3_uhot* nex_u; // internal list
|
||||
} u3_uhot;
|
||||
|
10
v/sist.c
10
v/sist.c
@ -276,6 +276,7 @@ _sist_sing(u3_noun ovo)
|
||||
static void
|
||||
_sist_home()
|
||||
{
|
||||
c3_c mak_c[2048];
|
||||
c3_c ful_c[2048];
|
||||
|
||||
// Create subdirectories.
|
||||
@ -321,7 +322,14 @@ _sist_home()
|
||||
// Copy zod files, if we're generating a carrier.
|
||||
//
|
||||
if ( u3_Host.ops_u.imp_c ) {
|
||||
snprintf(ful_c, 2048, "cp -r %s/zod %s/%s",
|
||||
snprintf(mak_c, 2048, "mkdir %s/%s",
|
||||
u3_Host.dir_c, u3_Host.ops_u.imp_c+1);
|
||||
printf("%s\r\n", mak_c);
|
||||
if ( 0 != system(mak_c) ) {
|
||||
uL(fprintf(uH, "could not %s\n", mak_c));
|
||||
u3_lo_bail();
|
||||
}
|
||||
snprintf(ful_c, 2048, "cp -r %s/zod %s/%s/in",
|
||||
U3_LIB, u3_Host.dir_c, u3_Host.ops_u.imp_c+1);
|
||||
printf("%s\r\n", ful_c);
|
||||
if ( 0 != system(ful_c) ) {
|
||||
|
34
v/unix.c
34
v/unix.c
@ -1046,7 +1046,13 @@ _unix_hot_gain(u3_noun who, u3_noun mek)
|
||||
u3_noun hox = u3dc("scot", 'p', u3k(who));
|
||||
c3_c* hox_c = u3r_string(hox);
|
||||
c3_c* pax_c = _unix_down(u3_Host.dir_c, hox_c + 1);
|
||||
c3_c* pin_c = _unix_down(pax_c, "in");
|
||||
c3_c* pot_c = _unix_down(pax_c, "out");
|
||||
DIR* rid_u = opendir(pax_c);
|
||||
DIR* rin_u = opendir(pin_c);
|
||||
DIR* rot_u = opendir(pot_c);
|
||||
|
||||
free(pax_c);
|
||||
|
||||
if ( !rid_u ) {
|
||||
if ( c3y == mek ) {
|
||||
@ -1057,17 +1063,38 @@ _unix_hot_gain(u3_noun who, u3_noun mek)
|
||||
return;
|
||||
}
|
||||
} else closedir(rid_u);
|
||||
if ( !rin_u ) {
|
||||
if ( c3y == mek ) {
|
||||
_unix_mkdir(pin_c);
|
||||
} else {
|
||||
u3z(who);
|
||||
u3z(hox);
|
||||
return;
|
||||
}
|
||||
} else closedir(rin_u);
|
||||
if ( !rot_u ) {
|
||||
if ( c3y == mek ) {
|
||||
_unix_mkdir(pot_c);
|
||||
} else {
|
||||
u3z(who);
|
||||
u3z(hox);
|
||||
return;
|
||||
}
|
||||
} else closedir(rot_u);
|
||||
|
||||
// uL(fprintf(uH, "GAIN %s\n", pax_c));
|
||||
|
||||
free(hox_c);
|
||||
u3z(hox);
|
||||
u3_unix_acquire(pax_c);
|
||||
u3_unix_acquire(pin_c);
|
||||
|
||||
{
|
||||
u3_uhot* hot_u = c3_malloc(sizeof(u3_uhot));
|
||||
|
||||
_unix_dir_watch(&hot_u->dir_u, 0, pax_c);
|
||||
_unix_dir_watch(&hot_u->dir_u, 0, pin_c);
|
||||
|
||||
hot_u->dot_u = pot_c;
|
||||
|
||||
_unix_ship_out(who, hot_u->who_w);
|
||||
u3z(who);
|
||||
|
||||
@ -1334,7 +1361,7 @@ u3_unix_ef_init(u3_noun who)
|
||||
u3v_plan(u3nq(u3_blip, c3__sync, u3k(u3A->sen), u3_nul),
|
||||
u3nq(c3__into, who,
|
||||
u3_blip,
|
||||
u3nt(c3y, u3nc(0, 0), u3_nul)));
|
||||
u3nt(u3_nul, u3_nul, u3_nul)));
|
||||
}
|
||||
|
||||
/* u3_unix_ef_ergo(): update filesystem, outbound.
|
||||
@ -1411,6 +1438,7 @@ u3_unix_ef_look(void)
|
||||
// uL(fprintf(uH, "sync: lose %s\n", hot_u->dir_u.pax_c));
|
||||
_unix_hot_lose(hot_u);
|
||||
|
||||
free(hot_u->dot_u);
|
||||
free(hot_u);
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user