mount.c,v
来自「TCP-IP红宝书源代码」· C,V 代码 · 共 76 行
C,V
76 行
head 1.1;
access;
symbols;
locks
dls:1.1; strict;
comment @ * @;
1.1
date 97.09.21.19.28.54; author dls; state Dist;
branches;
next ;
desc
@@
1.1
log
@pre-3e code
@
text
@/* mount.c - mount */
#include <conf.h>
#include <kernel.h>
#include <name.h>
/*------------------------------------------------------------------------
* mount - give meaning to a prefix in the abstract name space
*------------------------------------------------------------------------
*/
SYSCALL mount(prefix, dev, replace)
char *prefix;
char *replace;
int dev;
{
STATWORD ps;
struct nament *nptr;
struct nament *last;
int i;
if (prefix == NULL)
prefix == NULLSTR;
if (replace == NULL)
replace == NULLSTR;
if (strlen(prefix) >= NAMPLEN || strlen(replace) >= NAMRLEN)
return(SYSERR);
disable(ps);
for (i=0 ; i<Nam.nnames ; i++) {
nptr = &Nam.nametab[i];
if (strcmp(prefix,nptr->npre) == 0) {
strcpy(nptr->nrepl, replace);
nptr->ndev = dev;
restore(ps);
return(OK);
}
}
if (Nam.nnames >= NNAMES) {
restore(ps);
return(SYSERR);
}
nptr = last = &Nam.nametab[Nam.nnames++];
if (Nam.nnames > 1) { /* preserve last name prefix */
nptr = last - 1;
*last = *nptr;
}
strcpy(nptr->npre, prefix);
strcpy(nptr->nrepl, replace);
nptr->ndev = dev;
restore(ps);
return(OK);
}
@
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?