static int init_uffs_fs(void) { struct uffs_MountTableEntrySt *mtbl = &demo_mount; /* setup flash storage attributes */ setup_storage(femu_GetStorage()); /* setup memory allocator */ uffs_MemSetupStaticAllocator(&mtbl->dev->mem, static_buffer_pool, sizeof(static_buffer_pool)); /* setup device: init, release, attr */ setup_device(mtbl->dev); /* register mount table */ uffs_RegisterMountTable(mtbl); return uffs_InitMountTable() == U_SUCC ? 0 : -1; }
static int my_init_filesystem(void) { uffs_MountTable *mtbl = &(demo_mount_table[0]); /* setup nand storage attributes */ setup_flash_storage(&g_my_flash_storage); /* setup memory allocator */ uffs_MemSetupStaticAllocator(&demo_device_1.mem, static_buffer_par1, sizeof(static_buffer_par1)); uffs_MemSetupStaticAllocator(&demo_device_2.mem, static_buffer_par2, sizeof(static_buffer_par2)); /* register mount table */ while(mtbl->dev) { // setup device init/release entry mtbl->dev->Init = my_InitDevice; mtbl->dev->Release = my_ReleaseDevice; uffs_RegisterMountTable(mtbl); mtbl++; } return uffs_InitMountTable() == U_SUCC ? 0 : -1; }
/* mount and unmount file system */ int dfs_uffs_mount(struct dfs_filesystem* fs, unsigned long rwflag, const void* data) { return ((uffs_InitMountTable() == U_SUCC) ? 0 : -1); }