vxKernel/src/fs/_table.c

43 lines
809 B
C
Raw Normal View History

VxKernel 0.6.0-17 : Add RTC driver + prepare FS support @add <> include/vhex/display/draw/rect | add filled rectangle API <> src/display/draw/drect | add filled rectangle drawing API <> board/fxcg50/ | add devices special section (WIP) <> include/vhex/device | add device structure (WIP) <> include/vhex/driver/mpu/sh/sh7305/ | [intc] add primitive which allow dummy default interrupt handler | [rtc] add complete RTC hardware structure | [rtc] add hardware-level kernel API <> include/vhex/fs | add file system abstraction API (WIP) | add Fugue FAT file system abstraction API (WIP) <> include/vhex/rtc | add RTC user-level API | add driver-level interface | add kernel-level types <> src/fs | add base Fugue abstraction (WIP) | add libc functions (WIP) @update <> include/vhex/display/draw/text | merge halign and valign argument | add special alignment flags <> include/vhex/driver | add RTC driver flags <> include/vhex/driver/mpu/sh/sh7305/cpg | rename weird field | add Spread Spectrum emulator field | properly expand LSTATS register <> src/driver/mpu/sh/sh7305 | [intc] allow user-level interrupt handler installation | [intc] expose common interrupt handler | [rtc] add RTC entire driver <> src/driver/scree/r61524 | use complete VRAM instead of fragmented render @fix <> src/display | [text] fix height for text display geometry | [text] fix alignment calculation | [dclear] fix geometry support <> src/driver/mpu/sh/sh7305 | [cpg] fix driver installation | [cpg] fix driver spread spectrum | [cpg] fix driver declaration | [tmu] fix exception with the profiling primitives
2022-08-08 20:19:00 +02:00
#if 0
#include <vhex/fs.h>
#include <errno.h>
/* fs_table_reserve() : reserve file descriptor */
int fs_table_reserve(void **data)
{
*data = NULL;
for (int i = 3 ; i < VHEX_NB_FILE; ++i) {
if (fs_info.table[i] == NULL) {
fs_info.table[i] = (void*)0xdeadbeef;
*data = &fs_info.table[i];
return 0;
}
}
return ENFILE;
}
/* fs_table_find() : find device-specific data */
int fs_table_find(void **data, int fd)
{
*data = NULL;
if (fd < 0 || fd >= VHEX_NB_FILE)
return EBADF;
if (fs_info.table[fd] == NULL)
return EBADF;
*data = fs_info.table[fd];
return 0;
}
/* fs_table_remove() : remove file descriptor */
int fs_table_remove(int fd)
{
if (fd < 0 || fd >= VHEX_NB_FILE)
return EBADF;
if (fs_info.table[fd] == NULL)
return EBADF;
fs_info.table[fd] = NULL;
return 0;
}
#endif