|
|
1.1 ! root 1: /* mount.c - mount */ ! 2: ! 3: #include <conf.h> ! 4: #include <kernel.h> ! 5: #include <name.h> ! 6: ! 7: /*------------------------------------------------------------------------ ! 8: * mount - give meaning to a prefix in the abstract name space ! 9: *------------------------------------------------------------------------ ! 10: */ ! 11: SYSCALL mount(prefix, dev, replace) ! 12: char *prefix; ! 13: char *replace; ! 14: int dev; ! 15: { ! 16: struct nament *nptr; ! 17: struct nament *last; ! 18: int i; ! 19: PStype ps; ! 20: ! 21: if (prefix == NULL) ! 22: prefix == NULLSTR; ! 23: if (replace == NULL) ! 24: replace == NULLSTR; ! 25: if (strlen(prefix) >= NAMPLEN || strlen(replace) >= NAMRLEN) ! 26: return(SYSERR); ! 27: disable(ps); ! 28: for (i=0 ; i<Nam.nnames ; i++) { ! 29: nptr = &Nam.nametab[i]; ! 30: if (strcmp(prefix,nptr->npre) == 0) { ! 31: strcpy(nptr->nrepl, replace); ! 32: nptr->ndev = dev; ! 33: restore(ps); ! 34: return(OK); ! 35: } ! 36: } ! 37: if (Nam.nnames >= NNAMES) { ! 38: restore(ps); ! 39: return(SYSERR); ! 40: } ! 41: nptr = last = &Nam.nametab[Nam.nnames++]; ! 42: if (Nam.nnames > 1) { /* preserve last name prefix */ ! 43: nptr = last - 1; ! 44: *last = *nptr; ! 45: } ! 46: strcpy(nptr->npre, prefix); ! 47: strcpy(nptr->nrepl, replace); ! 48: nptr->ndev = dev; ! 49: restore(ps); ! 50: return(OK); ! 51: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.