From f8deea59a575c12e010ab2556dc86f097410bf53 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 10 Mar 2000 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2000-03-10 --- boot/boot.c | 21 ++++++++++++++++----- boot/settime.c | 6 +++--- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/boot/boot.c b/boot/boot.c index daea7edd8097bb0f65d9ac98f251ece5c4d7041a..60bef87fa82ff463da7fc4739d89c7a5bc5b063b 100644 --- a/boot/boot.c +++ b/boot/boot.c @@ -39,8 +39,10 @@ boot(int argc, char *argv[]) int fd; Method *mp; char cmd[64]; + char rootbuf[64]; char flags[6]; int islocal, ishybrid; + char *rp; sleep(1000); @@ -117,13 +119,22 @@ boot(int argc, char *argv[]) */ if(bind("/", "/", MREPL) < 0) fatal("bind /"); - if(mount(fd, "/root", MREPL|MCREATE, "") < 0) + rp = getenv("rootspec"); + if(rp == nil) + rp = ""; + if(mount(fd, "/root", MREPL|MCREATE, rp) < 0) fatal("mount /"); - if(bind(rootdir, "/", MAFTER|MCREATE) < 0) - fatal("bind /"); + rp = getenv("rootdir"); + if(rp == nil) + rp = rootdir; + if(strncmp(rp, "/root", 5) != 0){ + snprint(rootbuf, sizeof rootbuf, "/root/%s", rp); + rp = rootbuf; + } + if(bind(rp, "/", MAFTER|MCREATE) < 0) + fatal("second bind /"); close(fd); - - setenv("rootdir", rootdir); + setenv("rootdir", rp); /* * if a local file server exists and it's not diff --git a/boot/settime.c b/boot/settime.c index 3cfee8da5dd615be670604f471a7c2e10e9b7c8a..fc083566c1df98b52f0fed4d93306771c564d185 100644 --- a/boot/settime.c +++ b/boot/settime.c @@ -41,17 +41,17 @@ settime(int islocal) f = open(timeserver, ORDWR); if(f < 0) return; - if(mount(f, "/n/boot", MREPL, "") < 0){ + if(mount(f, "/mnt", MREPL, "") < 0){ warning("settime mount"); close(f); return; } close(f); - if(stat("/n/boot", dirbuf) < 0) + if(stat("/mnt", dirbuf) < 0) fatal("stat"); convM2D(dirbuf, &dir); sprint(dirbuf, "%ld", dir.atime); - unmount(0, "/n/boot"); + unmount(0, "/mnt"); } f = open("#c/time", OWRITE);