diff options
| author | Quentin Carbonneaux | 2022-04-07 19:21:46 +0200 |
|---|---|---|
| committer | Quentin Carbonneaux | 2022-04-08 12:14:41 +0200 |
| commit | 0b9eb1b1c457a22054d97242ad8f33c3dfbd8bd3 (patch) | |
| tree | 57fe005702e2dcc4f691a1072d7b3b15511e133b | |
| parent | c78347fedf40bb8a6a374b9e9c4012a5621caf1e (diff) | |
a bit of renaming
| -rw-r--r-- | sdar/all.h | 22 | ||||
| -rw-r--r-- | sdar/arch.c | 18 | ||||
| -rw-r--r-- | sdar/util.c | 12 | ||||
| -rw-r--r-- | sdar/write.c | 16 |
4 files changed, 34 insertions, 34 deletions
@@ -18,7 +18,7 @@ enum { Maxblk = 2 << 20, Entrysz = Hmacsz + 8, - Indexsz = Maxblk / Entrysz, + Lvlcap = Maxblk / Entrysz, Magicsz = 8, Segmetasz = 8 + 8 + 8 + 128, Seghdsz = Magicsz + Keysz + Cipovh + Segmetasz, @@ -39,9 +39,9 @@ typedef struct Block Block; typedef struct Cache Cache; typedef struct Cachemeta Cachemeta; typedef struct Chunker Chunker; -typedef struct Ientry Ientry; -typedef struct Ilevel Ilevel; +typedef struct Entry Entry; typedef struct Key Key; +typedef struct Level Level; typedef struct Loghd Loghd; typedef struct Reader Reader; typedef struct Segfile Segfile; @@ -84,14 +84,14 @@ struct Cache { Mmh hash; /* maps hmac to Block */ }; -struct Ientry { +struct Entry { hmac_t hmac; vlong len; }; -struct Ilevel { +struct Level { int nent; - Ientry ent[Indexsz]; + Entry ent[Lvlcap]; }; struct Reader { @@ -99,7 +99,7 @@ struct Reader { vlong pos; vlong pos1; hmac_t hmac0; /* hmac of level[0] */ - Ilevel level[2]; + Level level[2]; /* open segment */ FILE *segf; @@ -114,7 +114,7 @@ struct Writer { uint rhash; vlong vlen; vlong vlen0; - Ilevel level[2]; + Level level[2]; uchar buf[Bufpad + 2*Maxblk]; }; @@ -178,9 +178,9 @@ void encmeta(Slice *, Segmeta *); void decmeta(Slice, Segmeta *); void encitem(uchar *, hmac_t, int, long); void decitem(uchar *, Block *); -void addentry(Ilevel *, hmac_t, vlong); -void enclevel(Slice *, Ilevel *); -int declevel(Slice, Ilevel *); +void addentry(Level *, hmac_t, vlong); +void enclevel(Slice *, Level *); +int declevel(Slice, Level *); /* slice.c */ Slice mksl(uchar *, long); diff --git a/sdar/arch.c b/sdar/arch.c index f82b27c..67a1a26 100644 --- a/sdar/arch.c +++ b/sdar/arch.c @@ -373,7 +373,7 @@ error: } static int -readlevel(Reader *rd, hmac_t hmac, Ilevel *l) +readlevel(Reader *rd, hmac_t hmac, Level *l) { Block b; Slice s; @@ -397,8 +397,8 @@ readerinit(Reader *r, Arch *arch) int readerstart(Reader *r, Addr *addr, vlong off) { - Ilevel *l; - Ientry *ent; + Level *l; + Entry *ent; hmac_t hmac; assert(key.sec); @@ -448,10 +448,10 @@ readerdone(Reader *r) } } -static Ientry * -findentry(Ilevel *l, vlong *off, vlong pos) +static Entry * +findentry(Level *l, vlong *off, vlong pos) { - Ientry *e; + Entry *e; int i; assert(*off <= pos); @@ -469,8 +469,8 @@ findentry(Ilevel *l, vlong *off, vlong pos) int readerseek(Reader *r, vlong pos) { - Ilevel *l; - Ientry *e; + Level *l; + Entry *e; r->pos = pos; l = r->level; @@ -493,7 +493,7 @@ reader(Reader *r, Slice *s) Block b; vlong pos; long n; - Ientry *e; + Entry *e; if (readerseek(r, r->pos)) return 1; diff --git a/sdar/util.c b/sdar/util.c index add43fc..bc011a1 100644 --- a/sdar/util.c +++ b/sdar/util.c @@ -220,9 +220,9 @@ decitem(uchar *p, Block *b) } void -addentry(Ilevel *l, hmac_t hmac, vlong len) +addentry(Level *l, hmac_t hmac, vlong len) { - Ientry *e; + Entry *e; e = &l->ent[l->nent++]; hmaccpy(e->hmac, hmac); @@ -230,9 +230,9 @@ addentry(Ilevel *l, hmac_t hmac, vlong len) } void -enclevel(Slice *s, Ilevel *l) +enclevel(Slice *s, Level *l) { - Ientry *e; + Entry *e; uchar *p; int i; @@ -247,14 +247,14 @@ enclevel(Slice *s, Ilevel *l) } int -declevel(Slice s, Ilevel *l) +declevel(Slice s, Level *l) { uchar *p; vlong n, len; p = s.buf; n = s.len; - if (n % Entrysz != 0 || n / Entrysz > Indexsz) + if (n % Entrysz != 0 || n / Entrysz > Lvlcap) return 1; l->nent = 0; for (; n > 0; n -= Entrysz) { diff --git a/sdar/write.c b/sdar/write.c index e09eea6..41be2ed 100644 --- a/sdar/write.c +++ b/sdar/write.c @@ -2,7 +2,7 @@ #include <limits.h> #include <string.h> -MAKESURE(vlong_is_enough_for_vlen, (uvlong)Indexsz * Maxblk <= LLONG_MAX); +MAKESURE(vlong_is_enough_for_vlen, (uvlong)Lvlcap * Maxblk <= LLONG_MAX); MAKESURE(Avglog_ok, 6 < Avglog && Avglog < 32); void @@ -30,12 +30,12 @@ flush(Writer *w, Slice s, hmac_t hmac) } static int -flushlevel(Writer *w, Ilevel *l, hmac_t hmac) +flushlevel(Writer *w, Level *l, hmac_t hmac) { Slice s; int err; - assert(l->nent > 0 && l->nent <= Indexsz); + assert(l->nent > 0 && l->nent <= Lvlcap); s = newsl(); enclevel(&s, l); err = flush(w, s, hmac); @@ -47,13 +47,13 @@ static int flushlevel0(Writer *w) { hmac_t hmac; - Ilevel *l; + Level *l; l = w->level; if (flushlevel(w, &l[0], hmac)) return 1; - if (l[1].nent == Indexsz) { + if (l[1].nent == Lvlcap) { logs("E that's a biggie"); return 1; } @@ -70,7 +70,7 @@ static int chunkdone(Writer *w, uchar *buf, int sz) { hmac_t hmac; - Ilevel *l0; + Level *l0; assert(sz <= Maxblk); @@ -81,7 +81,7 @@ chunkdone(Writer *w, uchar *buf, int sz) return 1; l0 = &w->level[0]; - if (l0->nent == Indexsz) + if (l0->nent == Lvlcap) if (flushlevel0(w)) return 1; addentry(l0, hmac, sz); @@ -168,7 +168,7 @@ writer(Writer *w, uchar *b, vlong nb) int writerdone(Writer *w, Addr *a) { - Ilevel *l; + Level *l; if (chunkdone(w, w->buf + Bufpad, w->bpos)) return 1; |
