From 27fd88af23b165c1c3c454cb1e1f889d9b74784c Mon Sep 17 00:00:00 2001 From: aiju Date: Thu, 28 Jul 2011 14:22:39 +0200 Subject: devshr: rename hook --- sys/src/9/pc/pccpuf | 1 + sys/src/9/pc/pcf | 1 + sys/src/9/port/auth.c | 1 + sys/src/9/port/devshr.c | 12 ++++++++++++ sys/src/9/port/portfns.h | 1 + 5 files changed, 16 insertions(+) diff --git a/sys/src/9/pc/pccpuf b/sys/src/9/pc/pccpuf index 6e50e3c9a..4605736aa 100644 --- a/sys/src/9/pc/pccpuf +++ b/sys/src/9/pc/pccpuf @@ -9,6 +9,7 @@ dev proc mnt srv + shr dup rtc ssl diff --git a/sys/src/9/pc/pcf b/sys/src/9/pc/pcf index bfebfa2b5..f4e31d9eb 100644 --- a/sys/src/9/pc/pcf +++ b/sys/src/9/pc/pcf @@ -9,6 +9,7 @@ dev proc mnt srv + shr dup rtc ssl diff --git a/sys/src/9/port/auth.c b/sys/src/9/port/auth.c index 7521e5a43..6c4bdac98 100644 --- a/sys/src/9/port/auth.c +++ b/sys/src/9/port/auth.c @@ -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; diff --git a/sys/src/9/port/devshr.c b/sys/src/9/port/devshr.c index 62442b018..4b11d6634 100644 --- a/sys/src/9/port/devshr.c +++ b/sys/src/9/port/devshr.c @@ -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); +} \ No newline at end of file diff --git a/sys/src/9/port/portfns.h b/sys/src/9/port/portfns.h index 4dd37938d..6e6653901 100644 --- a/sys/src/9/port/portfns.h +++ b/sys/src/9/port/portfns.h @@ -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); -- cgit v1.2.3