mirror of
https://github.com/vivier/EMILE.git
synced 2025-02-06 23:30:37 +00:00
ext2_init() fails if device is not an ext2 filesystem
This commit is contained in:
parent
4e79c0b645
commit
be678577f6
@ -5,9 +5,23 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libext2.h"
|
#include "libext2.h"
|
||||||
|
#include "ext2.h"
|
||||||
|
#include "ext2_utils.h"
|
||||||
|
|
||||||
|
static int is_ext2(device_io_t *device)
|
||||||
|
{
|
||||||
|
struct ext2_super_block super;
|
||||||
|
ext2_get_super(device, &super);
|
||||||
|
if (super.s_magic == EXT2_SUPER_MAGIC)
|
||||||
|
return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int ext2_init(device_io_t *device, filesystem_io_t *fs)
|
int ext2_init(device_io_t *device, filesystem_io_t *fs)
|
||||||
{
|
{
|
||||||
|
if (!is_ext2(device))
|
||||||
|
return -1;
|
||||||
|
|
||||||
fs->mount = ext2_mount;
|
fs->mount = ext2_mount;
|
||||||
fs->open = ext2_open;
|
fs->open = ext2_open;
|
||||||
fs->read = ext2_read;
|
fs->read = ext2_read;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user