File read/write offset
Added offset integration.
This commit is contained in:
parent
4990227b5c
commit
2a6c555082
1 changed files with 19 additions and 7 deletions
|
@ -26,17 +26,29 @@
|
|||
|
||||
static int sys_read(int fd, const char *buf, size_t len)
|
||||
{
|
||||
read_fs(per_core(current_task)->fildes_table[fd].node, (uint8_t*)buf, len, per_core(current_task)->fildes_table[fd].offset);
|
||||
kprintf("fd:%i, Dateilaenge:%i, Dateiinhalt: %s \n", fd, len, buf);
|
||||
return len; ////////ACHTUNG: liest noch über das Dateiende hinaus
|
||||
unsigned int readbytes;
|
||||
readbytes = read_fs(
|
||||
per_core(current_task)->fildes_table[fd].node,
|
||||
(uint8_t*)buf, len,
|
||||
per_core(current_task)->fildes_table[fd].offset);
|
||||
per_core(current_task)->fildes_table[fd].offset += readbytes;
|
||||
/*kprintf("fd:%i, Dateilaenge:%i, Dateiinhalt: %s \n", fd, len, buf);*/
|
||||
/* Beware: still reading above file limit! */
|
||||
return readbytes;
|
||||
}
|
||||
|
||||
static int sys_write(int fd, const char *buf, size_t len)
|
||||
{
|
||||
//per_core(current_task)->fildes_table[fd].node->write = 1;
|
||||
write_fs(per_core(current_task)->fildes_table[fd].node, (uint8_t*)buf, len, 0);//per_core(current_task)->fildes_table[fd].offset);
|
||||
kprintf("ins Dateis. geschr. -- fd:%i, Dateilaenge:%i, Dateiinhalt: %s \n", fd, len, buf);
|
||||
return len; ////////ACHTUNG: gaukelt dem Benutzer vor alles geschrieben zu haben.
|
||||
unsigned int wrotebytes;
|
||||
/* per_core(current_task)->fildes_table[fd].node->write = 1; */
|
||||
wrotebytes = write_fs(
|
||||
per_core(current_task)->fildes_table[fd].node,
|
||||
(uint8_t*)buf, len, 0);
|
||||
/* per_core(current_task)->fildes_table[fd].offset); */
|
||||
/* kprintf("ins Dateis. geschr. -- fd:%i, Dateilaenge:%i, Dateiinhalt: %s \n", fd, len, buf); */
|
||||
per_core(current_task)->fildes_table[fd].offset += wrotebytes;
|
||||
|
||||
return wrotebytes;
|
||||
}
|
||||
|
||||
static int sys_open(const char* file, int flags, int mode)
|
||||
|
|
Loading…
Add table
Reference in a new issue