return len;
}
-void
-open(Fat *fat, void *f, ulong lba)
-{
- File *fp = f;
-
- fp->fat = fat;
- fp->lba = lba;
- fp->len = 0;
- fp->lbaoff = 0;
- fp->clust = ~0U;
- fp->rp = fp->ep = fp->buf + Sectsz;
-}
-
void
close(void *)
{
return *((ushort*)d->starthi)<<16 | *((ushort*)d->startlo);
}
+static void
+fileinit(File *fp, Fat *fat, ulong lba)
+{
+ fp->fat = fat;
+ fp->lba = lba;
+ fp->len = 0;
+ fp->lbaoff = 0;
+ fp->clust = ~0U;
+ fp->rp = fp->ep = fp->buf + Sectsz;
+}
+
static int
fatwalk(File *fp, Fat *fat, char *path)
{
Dir d;
if(fat->ver == Fat32){
- open(fat, fp, 0);
+ fileinit(fp, fat, 0);
fp->clust = fat->dirstart;
fp->len = ~0U;
}else{
- open(fat, fp, fat->dirstart);
+ fileinit(fp, fat, fat->dirstart);
fp->len = fat->dirents * Dirsz;
}
for(;;){
end = path + strlen(path);
j = end - path;
if(i == j && memcmp(name, path, j) == 0){
- open(fat, fp, 0);
+ fileinit(fp, fat, 0);
fp->clust = dirclust(&d);
fp->len = *((ulong*)d.len);
if(*end == 0)