|
|
1.1 ! root 1: #include <u.h> ! 2: #include <libc.h> ! 3: #include <../boot/boot.h> ! 4: ! 5: static int ! 6: dkdial(int *dfd, char *dest) ! 7: { ! 8: int i; ! 9: ! 10: for(i = 0; ; i++){ ! 11: if(plumb("#k/dk", dest, dfd, 0) >= 0) ! 12: break; ! 13: if(i == 5) ! 14: return -1; ! 15: sleep(500); ! 16: } ! 17: sendmsg(dfd[0], "init"); ! 18: return dfd[1]; ! 19: } ! 20: ! 21: int ! 22: dkauth(void) ! 23: { ! 24: char path[2*NAMELEN]; ! 25: char *p; ! 26: int dfd[2]; ! 27: ! 28: strcpy(path, sys); ! 29: p = strrchr(path, '/'); ! 30: if(p) ! 31: p++; ! 32: else ! 33: p = path; ! 34: strcpy(p, "p9auth!ticket"); ! 35: if(dkdial(dfd, path) < 0) ! 36: return -1; ! 37: close(dfd[0]); ! 38: return dfd[1]; ! 39: } ! 40: ! 41: int ! 42: dkconnect(void) ! 43: { ! 44: int fd[2]; ! 45: ! 46: if(*sys == 0) ! 47: strcpy(sys, "Nfs"); ! 48: if(dkdial(fd, sys) < 0) ! 49: return -1; ! 50: if(cpuflag) ! 51: sendmsg(fd[0], "push reboot"); ! 52: close(fd[0]); ! 53: return fd[1]; ! 54: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.