Lines Matching full:boot
224 resetDosDirSection(struct bootblock *boot, struct fatEntry *fat)
230 b1 = boot->RootDirEnts * 32;
231 b2 = boot->SecPerClust * boot->BytesPerSec;
240 if (boot->flags & FAT32) {
241 if (boot->RootCl < CLUST_FIRST || boot->RootCl >= boot->NumClusters) {
243 boot->RootCl);
246 cl = fat[boot->RootCl].next;
249 || fat[boot->RootCl].head != boot->RootCl) {
260 fat[boot->RootCl].next = CLUST_FREE;
266 fat[boot->RootCl].flags |= FAT_USED;
267 rootDir->head = boot->RootCl;
307 delete(int f, struct bootblock *boot, struct fatEntry *fat, cl_t startcl,
312 int clsz = boot->SecPerClust * boot->BytesPerSec;
316 while (startcl >= CLUST_FIRST && startcl < boot->NumClusters) {
322 off = startcl * boot->SecPerClust + boot->ClusterOffset;
323 off *= boot->BytesPerSec;
355 removede(int f, struct bootblock *boot, struct fatEntry *fat, u_char *start,
371 if (delete(f, boot, fat,
390 checksize(struct bootblock *boot, struct fatEntry *fat, u_char *p,
401 if (dir->head < CLUST_FIRST || dir->head >= boot->NumClusters)
403 physicalSize = fat[dir->head].length * boot->ClusterSize;
417 } else if (physicalSize - dir->size >= boot->ClusterSize) {
424 for (cl = dir->head; (sz += boot->ClusterSize) < dir->size;)
426 clearchain(boot, fat, fat[cl].next);
443 check_dot_dot(int f, struct bootblock *boot, struct fatEntry *fat,struct dosDirEntry *dir)
455 if (dir->parent && (cl < CLUST_FIRST || cl >= boot->NumClusters)) {
460 if (!(boot->flags & FAT32) && !dir->parent) {
461 last = boot->RootDirEnts * 32;
462 off = boot->ResSectors + boot->FATs * boot->FATsecs;
464 last = boot->SecPerClust * boot->BytesPerSec;
465 off = cl * boot->SecPerClust + boot->ClusterOffset;
468 off *= boot->BytesPerSec;
505 } while ((cl = fat[cl].next) >= CLUST_FIRST && cl < boot->NumClusters);
525 readDosDirSection(int f, struct bootblock *boot, struct fatEntry *fat,
542 if (dir->parent && (cl < CLUST_FIRST || cl >= boot->NumClusters)) {
554 if (!(boot->flags & FAT32) && !dir->parent) {
555 last = boot->RootDirEnts * 32;
556 off = boot->ResSectors + boot->FATs * boot->FATsecs;
558 last = boot->SecPerClust * boot->BytesPerSec;
559 off = cl * boot->SecPerClust + boot->ClusterOffset;
562 off *= boot->BytesPerSec;
596 if (delete(f, boot, fat,
714 mod |= removede(f, boot, fat,
740 if (boot->ClustMask == CLUST32_MASK)
753 mod |= k = removede(f, boot, fat,
775 if (boot->ClustMask == CLUST32_MASK)
777 clearchain(boot, fat, dirent.head);
791 || dirent.head >= boot->NumClusters
800 || dirent.head >= boot->NumClusters)
825 if (boot->ClustMask == CLUST32_MASK)
834 if (dirent.head >= CLUST_FIRST && dirent.head < boot->NumClusters)
864 if (boot->ClustMask == CLUST32_MASK) {
882 if (boot->ClustMask == CLUST32_MASK)
895 if (boot->ClustMask == CLUST32_MASK) {
921 if (check_dot_dot(f,boot,fat,&dirent)) {
953 mod |= k = checksize(boot, fat, p, &dirent);
957 boot->NumFiles++;
968 } while ((cl = fat[cl].next) >= CLUST_FIRST && cl < boot->NumClusters);
970 mod |= removede(f, boot, fat,
978 handleDirTree(int dosfs, struct bootblock *boot, struct fatEntry *fat)
982 mod = readDosDirSection(dosfs, boot, fat, rootDir);
1003 mod |= readDosDirSection(dosfs, boot, fat, dir);
1019 reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head)
1038 lfbuf = malloc(boot->ClusterSize);
1048 for (; p < lfbuf + boot->ClusterSize; p += 32)
1052 if (p && p < lfbuf + boot->ClusterSize)
1055 if (lfcl < CLUST_FIRST || lfcl >= boot->NumClusters) {
1058 lfcl = (lostDir->head < boot->NumClusters) ? lostDir->head : 0;
1061 lfoff = lfcl * boot->ClusterSize
1062 + boot->ClusterOffset * boot->BytesPerSec;
1064 || read(dosfs, lfbuf, boot->ClusterSize) != boot->ClusterSize) {
1071 boot->NumFiles++;
1077 d.size = fat[head].length * boot->ClusterSize;
1084 if (boot->ClustMask == CLUST32_MASK) {
1094 || write(dosfs, lfbuf, boot->ClusterSize) != boot->ClusterSize) {