Extracting FFS from FreeBSD

Takanori Watanabe takawata at axe-inc.co.jp
Tue Oct 19 02:06:29 PDT 2004


In message <200410180814.i9I8ET70015904 at space.se>, "Daniel Gustafsson" wrote:
>
>Hello.
>
>I am working in a project which is in need of a stand-alone file system and
>I am interested in extracting FFS from BSD and modyfi it to a stand-alone
>module. I have some questions before I begin:
>
>1. Is there any simple way to get FFS source code including all the layers
>nessesary to make a separate module (any tips and hints)?
>
>2. Is there any Blockbased RAM driver available (or something like it) that
>can be used to test the system on RAM?
>
>3. Can somebody give me some information about the footprint of FFS?
>
>4. Does somebody have any tips of other file systems that already work as a
>stand-alone module (requirements: blocksize(4-16K), partitions(>=1GB))? 

How about libstand(3) in /usr/src/lib/libstand, 
which is used in /boot/loader(8)?
I don't think the FS support code in it does
not support multi user. 

Following code is not work, but  can be linked with 
%cc -nostdlib -ffreestanding -static hoge.c -lstand

% file hoge
hoge: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), statically linked, stripped
% ls -l hoge
-rwxr-xr-x  1 takawata  wheel  16020 10 19 17:57 hoge
%size hoge
   text    data     bss     dec     hex filename
  13257     264     536   14057    36e9 hoge
# size ufs.ko
   text    data     bss     dec     hex filename
 203060    6404     452  209916   333fc ufs.ko

==hoge.c
#include <stand.h>
#define STUB

struct fs_ops *file_system[] = {
  &ufs_fsops,
  NULL
};

struct devsw mydev = {
};

struct devsw *devsw[] = {
  &mydev,
  NULL
};
#ifdef STUB
int getchar(void)
{
  return 0;
}
int ischar(void)
{
  return 0;
}
void putchar(int c)
{
  return ;
}
int devopen(struct open_file *of, const char *name,const char **file)
{
  return EBUSY;
}
void panic(const char *msg, ...)
{
  for(;;);
}
#endif
main()
{
  int a;
}



More information about the freebsd-fs mailing list