1
0
Fork 0
mirror of https://gitlab.com/bztsrc/bootboot.git synced 2023-02-13 20:54:32 -05:00

Update LeanFS to v0.8

This commit is contained in:
bzt 2022-11-11 19:45:03 +01:00
parent eb3edda68a
commit 1a36775605
4 changed files with 12 additions and 9 deletions

View file

@ -19,7 +19,7 @@ fájlrendszerek:
| `fat` | ✗No | ✔Yes | [spec](https://gitlab.com/bztsrc/bootboot/raw/binaries/specs/vfat.pdf) (csak nem-ESP, LFN-el) |
| `minix` | ✗No | ✔Yes | [V2 spec](https://gitlab.com/bztsrc/bootboot/raw/binaries/specs/minix.pdf), [V3 forrás](https://github.com/Stichting-MINIX-Research-Foundation/minix/tree/master/minix/fs/mfs) (V3 támogatott, de csak V2-höz van spec) |
| `ext2` | ✗No | ✔Yes | [spec](https://gitlab.com/bztsrc/bootboot/raw/binaries/specs/ext2.pdf), [dokumentáció](https://www.nongnu.org/ext2-doc/ext2.html) |
| `lean` | ✗No | ✔Yes | [V0.6 spec](http://freedos-32.sourceforge.net/lean/specification.php), [V0.7 spec](http://www.fysnet.net/leanfs/specification.php) |
| `lean` | ✗No | ✔Yes | [V0.6 spec](http://freedos-32.sourceforge.net/lean/specification.php), [V0.8 spec](http://www.fysnet.net/leanfs/specification.php) |
A kód úgy lett megírva, hogy könnyű legyen bővíteni új fájlrendszerekkel.

View file

@ -18,7 +18,7 @@ also creates an initrd or a disk partition from a directory. Supported file syst
| `fat` | ✗No | ✔Yes | [spec](https://gitlab.com/bztsrc/bootboot/raw/binaries/specs/vfat.pdf) (non-ESP only, with LFN) |
| `minix` | ✗No | ✔Yes | [V2 spec](https://gitlab.com/bztsrc/bootboot/raw/binaries/specs/minix.pdf), [V3 source](https://github.com/Stichting-MINIX-Research-Foundation/minix/tree/master/minix/fs/mfs) (V3 supported, but there's only V2 spec) |
| `ext2` | ✗No | ✔Yes | [spec](https://gitlab.com/bztsrc/bootboot/raw/binaries/specs/ext2.pdf), [documentation](https://www.nongnu.org/ext2-doc/ext2.html) |
| `lean` | ✗No | ✔Yes | [V0.6 spec](http://freedos-32.sourceforge.net/lean/specification.php), [V0.7 spec](http://www.fysnet.net/leanfs/specification.php) |
| `lean` | ✗No | ✔Yes | [V0.6 spec](http://freedos-32.sourceforge.net/lean/specification.php), [V0.8 spec](http://www.fysnet.net/leanfs/specification.php) |
The code is written in a way that it is easily expandable with new file systems.

View file

@ -173,7 +173,7 @@ unsigned char *fat_writelfn(unsigned char *dir, char *name, int type, int size,
dir[0x1C] = size & 0xFF; dir[0x1D] = (size >> 8) & 0xFF;
dir[0x1E] = (size >> 16) & 0xFF; dir[0x1F] = (size >> 24) & 0xFF;
}
if(!clu) clu = fat_nextcluster;
if(!clu) clu = size > 0 || type ? fat_nextcluster : 0;
if(clu < 3) clu = 0;
dir[0x1A] = clu & 0xFF; dir[0x1B] = (clu >> 8) & 0xFF;
dir[0x14] = (clu >> 16) & 0xFF; dir[0x15] = (clu >> 24) & 0xFF;
@ -220,7 +220,7 @@ void fat_open(gpt_t *gpt_entry)
fat_fat32_1 = fat_fat32_2 = NULL;
} else {
/* FAT32 */
fat_spf = (fat_numclu*4) / 512 - 8;
fat_spf = (fat_numclu*4) / 512;
fs_base[0xD] = SECTOR_PER_CLUSTER; fs_base[0xE] = 8;
fs_base[0x24] = fat_spf & 0xFF; fs_base[0x25] = (fat_spf >> 8) & 0xFF;
fs_base[0x26] = (fat_spf >> 16) & 0xFF; fs_base[0x27] = (fat_spf >> 24) & 0xFF;
@ -244,7 +244,7 @@ void fat_open(gpt_t *gpt_entry)
void fat_add(struct stat *st, char *name, unsigned char *content, int size)
{
int parent = 2, clu, i;
int parent = 2, clu, i, j;
unsigned char *dir = fat_rootdir;
char *end, *fn = strrchr(name, '/');
if(!fn) fn = name; else fn++;
@ -256,7 +256,7 @@ void fat_add(struct stat *st, char *name, unsigned char *content, int size)
if(!end) end = name + strlen(name);
fat_lfncnt = 1;
do {
dir = fat_readlfn(dir, &clu, &size, parent);
dir = fat_readlfn(dir, &clu, &j, parent);
if(!dir) return;
if(!memcmp(fat_lfn, fn, end - fn) && !fat_lfn[end - fn]) {
fat_lfncnt = 1;

View file

@ -25,14 +25,17 @@
*
* This file is part of the BOOTBOOT Protocol package.
* @brief LeanFS file system driver
* See http://freedos-32.sourceforge.net/lean/specification.php
* See http://www.fysnet.net/leanfs/specification.php
* See http://freedos-32.sourceforge.net/lean/specification.php (v0.6, original)
* See http://www.fysnet.net/leanfs/specification.php (v0.7 and later, forked by fys)
*
* The FS we create here does not use any v0.8 or v0.7 specific features, hence it is v0.6 compatible
* (no hidden or undeleted files, no bad sectors, sector size 512 bytes, six extents per inode etc.)
*
*/
#include "main.h"
#define LEAN_SUPER_MAGIC 0x4E41454C
#define LEAN_SUPER_VERSION 0x0007 /* could be 0x0006 as well, backwards compatible */
#define LEAN_SUPER_VERSION 0x0008 /* could be 6 or 7 as well */
#define LEAN_INODE_MAGIC 0x45444F4E
#define LEAN_INODE_EXTENT_CNT 6
#define LEAN_FT_MT 0