1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#include "lib9.h"
#include "logfs.h"
#include "nandfs.h"
#include "local.h"
char *
nandfsreformatblock(Nandfs *nandfs, long block, uchar tag, ulong path, int xcount, long *xdata, void *llsave, int *markedbad)
{
int bad;
char *errmsg;
NandfsBlockData *d;
long nerase;
if (nandfs->blockdata == nil)
return Eperm;
nerase = *(ulong *)llsave;
errmsg = nandfsformatblock(nandfs, block, tag, path,
nandfs->baseblock, nandfs->limitblock - nandfs->baseblock, xcount, xdata, &nerase, &bad);
if (markedbad)
*markedbad = bad;
if (errmsg)
return errmsg;
d = &nandfs->blockdata[block];
d->tag = bad ? LogfsTbad : tag;
d->path = path;
d->nerase = nerase;
d->partial = 0;
return nil;
}
|