The code that causes it is this:
Code: Select all
file_handle_t f;
.. the struct:
typedef uint32_t (*read_type_t)(struct fs_node*,uint32_t off,uint32_t len,uint8_t* buffer);
typedef uint32_t (*write_type_t)(struct fs_node*,uint32_t off,uint32_t len,uint8_t* buffer);
//typedef struct dirent * (*readdir_type_t)(struct fs_node*,uint32_t index);
typedef struct fs_node * (*finddir_type_t)(struct fs_node*,char *name);
typedef int (*close_type_t)(struct fs_node*);
typedef struct{
uint32_t type;
uint32_t mask;
uint32_t uid;
uint32_t gid;
}file_flags_t;
typedef struct {
read_type_t read;
write_type_t write;
close_type_t close;
uint32_t (*get_size)(struct fs_node*);
}fs_file_func;
typedef struct {
int (*get_node)(struct fs_node*,char *name,uint32_t uid,uint32_t gid,struct fs_node* buffer);
int (*readdir)(struct fs_node*,uint32_t index,struct fs_node* buf);
int (*remove_node)(struct fs_node* node); //the file must not be open.
int (*new_symlink)(struct fs_node*,char* from,char *to, uint32_t uid,uint32_t gid);
int (*new_node)(struct fs_node*,char *name,file_flags_t *type,struct fs_node* new_file);
//in new_node, new_file is optional. It is ignored if NULL. else gives
//the new file node.
//get_node from here only works on single deep nodes, it doesn't follow directories.
}fs_dir_func;
typedef struct{
close_type_t close;
int (*open)(struct fs_node*,uint32_t uid,uint32_t gid,uint32_t mode);
int (*read_symlink)(struct fs_node*,char *string_buffer);
int (*read_flags)(struct fs_node*,file_flags_t* buffer);
int (*write_flags)(struct fs_node*,file_flags_t* source);
int (*lock)(struct fs_node*);
int (*unlock)(struct fs_node*);
//lock and unlock can not be used if the file is not open by the current process.
}fs_common_func;
typedef struct fs_node{
char name[256]; // The filename.(not including path)
uint32_t inode; // This is device-specific - provides a way for a filesystem to identify files..
uint32_t impl; // An implementation-defined number.
fs_file_func *file; //function pointer struct to avoid redundancy.
fs_dir_func *dir;
fs_common_func f;
struct mount_node *mp;
} file_handle_t;
typedef struct mount_node{
char name[256];
char dev_device[16]; //the /dev/* device, or 0 length if it doesn't use a /dev device.
uint32_t flags;
int (*get_node)(char *name,uint32_t uid,uint32_t gid,file_handle_t* buffer);
}mount_handle_t;
struct dirent
{
char name[256]; // Filename.
uint32_t inode; // Inode number. Required by POSIX.
};
Also, my CFLAGS are CFLAGS= -nostdlib -nostartfiles -nodefaultlibs -I ./include -fno-builtin