ref: fb1b0600f330175a0dee88c14a2fca5428e37d90
parent: 4f4c6a98f4cd1a604ec013b7ed1e5ab45095c691
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Nov 3 00:21:44 EDT 2023
fs: remove dead code
--- a/fns.h
+++ b/fns.h
@@ -63,6 +63,9 @@
u32int ihash(uvlong);
void finalize(Blk*);
+Mount* getmount(char*);
+void clunkmount(Mount*);
+
char* updatesnap(Tree**, Tree*, char*);
char* labelsnap(Tree*, char*);
char* delsnap(Tree*, vlong, char*);
@@ -85,6 +88,7 @@
Conn* newconn(int, int);
+int walk1(Tree*, vlong, char*, Qid*, vlong*);
char* loadusers(int, Tree*);
User* uid2user(int);
User* name2user(char*);
--- a/fs.c
+++ b/fs.c
@@ -8,9 +8,7 @@
#include "fns.h"
#include "atomic.h"
-static long tagtab[65536];
-
-static int
+int
walk1(Tree *t, vlong up, char *name, Qid *qid, vlong *len)
{
char *p, kbuf[Keymax], rbuf[Kvmax];
@@ -194,7 +192,6 @@
uchar buf[Max9p+IOHDRSZ];
int w, n;
- assert(asetl(&tagtab[m->tag], 0) == m->type);
r->tag = m->tag;
dprint("→ %F\n", r);
assert(m->type+1 == r->type || r->type == Rerror);
@@ -256,35 +253,6 @@
return btupsert(mnt->root, m, nm);
}
-/*
- * Clears all blocks in that intersect with
- * the range listed.
- */
-static char*
-clearb(int id, Mount *mnt, vlong qid, vlong off, vlong len)
-{
- char *e, buf[Offksz];
- Msg m;
-
- off &= ~(Blksz - 1);
- for(; off < len; off += Blksz){
- m.k = buf;
- m.nk = sizeof(buf);
- m.op = Oclearb;
- m.k[0] = Kdat;
- PACK64(m.k+1, qid);
- PACK64(m.k+9, off);
- m.v = nil;
- m.nv = 0;
- epochend(id);
- epochclean();
- epochstart(id);
- if((e = upsert(mnt, &m, 1)) != nil)
- return e;
- }
- return nil;
-}
-
static int
readb(Fid *f, char *d, vlong o, vlong n, vlong sz)
{
@@ -418,7 +386,7 @@
return de;
}
-static Mount *
+Mount *
getmount(char *name)
{
Mount *mnt;
@@ -458,7 +426,7 @@
return mnt;
}
-static void
+void
clunkmount(Mount *mnt)
{
Mount *me, **p;
@@ -2098,7 +2066,6 @@
Fcall r;
Fmsg *m;
u32int h;
- long old;
c = pc;
while(1){
@@ -2118,10 +2085,6 @@
}
dprint("← %F\n", &m->Fcall);
- if((old = asetl(&tagtab[m->tag], m->type)) != 0){
- fprint(2, "dup incoming tag: %d [type=%ld]\n", m->tag, old);
- abort();
- }
if(m->type == Tflush){
lk = &fs->flushq[ihash(m->oldtag) % Nflushtab];
wlock(lk);
--- a/user.c
+++ b/user.c
@@ -6,31 +6,6 @@
#include "dat.h"
#include "fns.h"
-static int
-walk1(Tree *t, vlong up, char *name, Qid *qid, vlong *len)
-{
- char *p, kbuf[Keymax], rbuf[Kvmax];
- int err;
- Xdir d;
- Kvp kv;
- Key k;
-
- err = 0;
- if((p = packdkey(kbuf, sizeof(kbuf), up, name)) == nil)
- return -1;
- k.k = kbuf;
- k.nk = p - kbuf;
- if(err)
- return -1;
- if(btlookup(t, &k, &kv, rbuf, sizeof(rbuf)) != nil)
- return -1;
- if(kv2dir(&kv, &d) == -1)
- return -1;
- *qid = d.qid;
- *len = d.length;
- return 0;
-}
-
static char*
slurp(Tree *t, vlong path, vlong len)
{