9 char buf[1024], *argv[3], *s;
13 switch(pid = rfork(RFCFDG|RFREND|RFPROC)){
17 open("/dev/null", ORDWR);
18 snprint(buf, sizeof(buf), "/sys/log/%s", progname);
19 if((fd = open(buf, OWRITE)) >= 0)
29 exits("failed to exec 9fs");
32 if((w = wait()) == nil)
39 if(s = strchr(w->msg, ':'))
57 char *tmp, *tmp2, *name, *root, *service, *fsname, *remark;
61 if(name = strrchr(path, '/'))
63 else if(name = strrchr(path, '\\'))
67 if(name==nil || *name==0 || *name=='.' || strchrs(name, "\\* ") || strstr(name, ".."))
69 root = tmp = smprint("/n/%s", name);
70 name = strtr(strrchr(root, '/')+1, tolowerrune);
72 stype = STYPE_DISKTREE;
74 remark = tmp2 = smprint("9fs %s; cd %s", name, root);
75 if(!strcmp(name, "local")){
78 remark = "The standard namespace";
80 if(!strcmp(name, "ipc$")){
86 remark = "The IPC service";
89 for(s = shares; s; s=s->next)
90 if(!strcmp(s->name, name))
93 logit("mapshare %s -> %s %s %s", path, service, name, root);
95 if(!strcmp(service, "A:") && (stype == STYPE_DISKTREE)){
96 if(!strcmp(fsname, "9fs") && (run9fs(name) < 0)){
97 logit("9fs %s: %r", name);
102 s = malloc(sizeof(*s));
103 s->service = strdup(service);
106 s->name = strdup(name);
107 s->root = strdup(root);
109 s->remark = strdup(remark);
110 s->fsname = strdup(fsname);
112 s->sectorsize = 0x200;
113 s->blocksize = 0x2000;
115 s->freesize = s->blocksize;