devshr: rename hook

This commit is contained in:
aiju 2011-07-28 14:22:39 +02:00
parent e3cc408215
commit 27fd88af23
5 changed files with 16 additions and 0 deletions

View file

@ -9,6 +9,7 @@ dev
proc
mnt
srv
shr
dup
rtc
ssl

View file

@ -9,6 +9,7 @@ dev
proc
mnt
srv
shr
dup
rtc
ssl

View file

@ -134,6 +134,7 @@ hostownerwrite(char *a, int n)
renameuser(eve, buf);
srvrenameuser(eve, buf);
shrrenameuser(eve, buf);
kstrdup(&eve, buf);
kstrdup(&up->user, buf);
up->basepri = PriNormal;

View file

@ -640,3 +640,15 @@ Dev shrdevtab = {
shrremove,
shrwstat,
};
void
shrrenameuser(char *old, char *new)
{
Shr *sp;
qlock(&shrlk);
for(sp = shr; sp; sp = sp->link)
if(sp->owner!=nil && strcmp(old, sp->owner)==0)
kstrdup(&sp->owner, new);
qunlock(&shrlk);
}

View file

@ -319,6 +319,7 @@ void splx(int);
void splxpc(int);
char* srvname(Chan*);
void srvrenameuser(char*, char*);
void shrrenameuser(char*, char*);
int swapcount(ulong);
int swapfull(void);
void swapinit(void);