git: 9front

Download patch

ref: 4c594588909815ddfced361ee78d0c3ffd2cbb24
parent: 09a9823d00d52572b1fad059d0417c71048185b7
author: aiju <aiju@phicode.de>
date: Thu Jul 28 10:22:39 EDT 2011

devshr: rename hook

--- a/sys/src/9/pc/pccpuf
+++ b/sys/src/9/pc/pccpuf
@@ -9,6 +9,7 @@
 	proc
 	mnt
 	srv
+	shr
 	dup
 	rtc
 	ssl
--- a/sys/src/9/pc/pcf
+++ b/sys/src/9/pc/pcf
@@ -9,6 +9,7 @@
 	proc
 	mnt
 	srv
+	shr
 	dup
 	rtc
 	ssl
--- a/sys/src/9/port/auth.c
+++ b/sys/src/9/port/auth.c
@@ -134,6 +134,7 @@
 
 	renameuser(eve, buf);
 	srvrenameuser(eve, buf);
+	shrrenameuser(eve, buf);
 	kstrdup(&eve, buf);
 	kstrdup(&up->user, buf);
 	up->basepri = PriNormal;
--- a/sys/src/9/port/devshr.c
+++ b/sys/src/9/port/devshr.c
@@ -640,3 +640,15 @@
 	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
--- a/sys/src/9/port/portfns.h
+++ b/sys/src/9/port/portfns.h
@@ -319,6 +319,7 @@
 void		splxpc(int);
 char*		srvname(Chan*);
 void		srvrenameuser(char*, char*);
+void		shrrenameuser(char*, char*);
 int		swapcount(ulong);
 int		swapfull(void);
 void		swapinit(void);
--