- enable flags O_RDONLY O_WRONLY and O_RDWR

This commit is contained in:
Marian Ohligs 2011-08-02 11:55:07 +02:00
parent a154525683
commit c7012f7bc0
3 changed files with 8 additions and 5 deletions

View file

@ -63,6 +63,9 @@ static ssize_t initrd_read(fildes_t* file, uint8_t* buffer, size_t size)
vfs_node_t* node = file->node;
block_list_t* blist = &node->block_list;
if (file->flags & O_WRONLY)
return -EACCES;
/* init the tmp offset */
offset = file->offset;
@ -109,9 +112,9 @@ static ssize_t initrd_write(fildes_t* file, uint8_t* buffer, size_t size)
vfs_node_t* node = file->node;
block_list_t* blist = &node->block_list;
if (BUILTIN_EXPECT(node->type != FS_FILE, 0))
return 0;
if (file->flags & O_RDONLY)
return -EACCES;
if (file->flags & O_APPEND)
file->offset = node->block_size;

View file

@ -168,10 +168,9 @@ int network_shutdown(void)
#elif defined(CONFIG_LWIP) && defined(CONFIG_PCI)
dhcp_release(default_netif);
dhcp_stop(default_netif);
#endif
mem_free(default_netif);
default_netif = NULL;
#endif
return 0;
}

View file

@ -403,6 +403,7 @@ static int load_task(load_args_t* largs)
//elf_section_header_t sec_header;
fildes_t file;
file.offset = 0;
file.flags = 0;
//TODO: init the hole fildes_t struct!
vfs_node_t* node;