shithub: riscv

Download patch

ref: c8d9390070a5c3585e064ee25a64c49e15618b99
parent: 4b08ef2c55fb442b90d44793f14e156e4852e80b
author: cinap_lenrek <[email protected]>
date: Tue Mar 14 19:46:35 EDT 2017

upas/fs: more cleanup...

--- a/sys/src/cmd/upas/fs/cache.c
+++ b/sys/src/cmd/upas/fs/cache.c
@@ -362,7 +362,6 @@
 void
 cachehash(Mailbox *mb, Message *m)
 {
-//	fprint(2, "cachehash %P\n", mpair(mb, m));
 	if(m->whole == m->whole->whole)
 		henter(PATH(mb->id, Qmbox), m->name,
 			(Qid){PATH(m->id, Qdir), 0, QTDIR}, m, mb);
--- a/sys/src/cmd/upas/fs/dat.h
+++ b/sys/src/cmd/upas/fs/dat.h
@@ -184,18 +184,9 @@
 	void	*aux;		/* private to Mailbox implementation */
 };
 
-/* print argument tango; can't varargck 2 types.  should fix compiler */
-typedef struct Mpair Mpair;
-struct Mpair {
-	Mailbox	*mb;
-	Message	*m;
-};
-Mpair mpair(Mailbox*, Message*);
-
 typedef char *Mailboxinit(Mailbox*, char*);
 
 Mailboxinit	plan9mbox;
-Mailboxinit	planbmbox;
 Mailboxinit	pop3mbox;
 Mailboxinit	imap4mbox;
 Mailboxinit	mdirmbox;
@@ -226,7 +217,6 @@
 char		*flagmessages(int, char**);
 void		digestmessage(Mailbox*, Message*);
 
-uintptr		absbos(void);
 void		eprint(char*, ...);
 void		iprint(char *, ...);
 int		newid(void);
@@ -250,9 +240,6 @@
 void		parseheaders(Mailbox*, Message*, int, int);
 void		parsebody(Message*, Mailbox*);
 char*		date822tounix(Message*, char*);
-int		fidmboxrefs(Mailbox*);
-int		hashmboxrefs(Mailbox*);
-void		checkmboxrefs(void);
 int		strtotm(char*, Tm*);
 char*		lowercase(char*);
 
@@ -375,7 +362,6 @@
 #define	Topmsg(mb, m)	(m->whole == mb->root)
 #pragma	varargck	type	"A"	uchar*
 #pragma	varargck	type	"D"	uvlong
-#pragma	varargck	type	"P"	Mpair
 #pragma	varargck	type	"Δ"	uvlong
 #pragma	varargck	argpos	eprint	1
 #pragma	varargck	argpos	iprint	1
--- a/sys/src/cmd/upas/fs/fs.c
+++ b/sys/src/cmd/upas/fs/fs.c
@@ -211,51 +211,6 @@
 	return fmtstrcpy(f, buf);
 }
 
-Mpair
-mpair(Mailbox *mb, Message *m)
-{
-	Mpair mp;
-
-	mp.mb = mb;
-	mp.m = m;
-	return mp;
-}
-
-static int
-Pfmt(Fmt *f)
-{
-	char buf[128], *p, *e;
-	int i, dots;
-	Mailbox *mb;
-	Message *t[32], *m;
-	Mpair mp;
-
-	mp = va_arg(f->args, Mpair);
-	mb = mp.mb;
-	m = mp.m;
-	if(m == nil || mb == nil)
-		return fmtstrcpy(f, "<P nil>");
-	i = 0;
-	for(; !Topmsg(mb, m); m = m->whole){
-		t[i++] = m;
-		if(i == nelem(t)-1)
-			break;
-	}
-	t[i++] = m;
-	dots = 0;
-	if(i == nelem(t))
-		dots = 1;
-	e = buf + sizeof buf;
-	p = buf;
-	if(dots)
-		p = seprint(p, e, ".../");
-	while(--i >= 1)
-		p = seprint(p, e, "%s/", t[i]->name);
-	if(i == 0)
-		seprint(p, e, "%s", t[0]->name);
-	return fmtstrcpy(f, buf);
-}
-
 void
 usage(void)
 {
@@ -375,7 +330,6 @@
 	fmtinstall(L'Δ', Δfmt);
 	fmtinstall('F', fcallfmt);
 	fmtinstall('H', encodefmt);		/* forces tls stuff */
-	fmtinstall('P', Pfmt);
 	quotefmtinstall();
 	if(pipe(p) < 0)
 		error("pipe failed");
@@ -833,9 +787,8 @@
 	if(nf->mtop = f->mtop)
 		msgincref(nf->mtop);
 	nf->qid = f->qid;
-	if(nf->mb){
+	if(nf->mb)
 		qunlock(nf->mb);
-	}
 	return nf;
 }
 
@@ -1413,9 +1366,8 @@
 	f->fid = -1;
 	f->open = 0;
 	mb = f->mb;
-	if(mb){
+	if(mb)
 		qlock(mb);
-	}
 	if(f->mtop)
 		msgdecref(mb, f->mtop);
 	if(f->m)
@@ -1749,7 +1701,6 @@
 	int h;
 	Hash *hp, **l;
 
-//if(m)sanemsg(m);
 	qlock(&hashlock);
 	h = hash(ppath, name);
 	for(l = &htab[h]; *l != nil; l = &(*l)->next){
@@ -1790,22 +1741,6 @@
 		}
 	}
 	qunlock(&hashlock);
-}
-
-int
-hashmboxrefs(Mailbox *mb)
-{
-	int h;
-	Hash *hp;
-	int refs = 0;
-
-	qlock(&hashlock);
-	for(h = 0; h < Hsize; h++)
-		for(hp = htab[h]; hp != nil; hp = hp->next)
-			if(hp->mb == mb)
-				refs++;
-	qunlock(&hashlock);
-	return refs;
 }
 
 void