initial commit
[pfinal.git] / Routix / include / routix / file.h
blobedea91f60959a6d0b85253ae12a62e805b6ced1b
1 /* file.h */
3 #ifndef __SYSTEM
4 #include "routix/system.h"
5 #endif
7 #ifndef __FAT12
8 #include "drivers/fat.h"
9 #endif
11 #ifndef __FILE
12 #define __FILE
15 typedef struct file_opened_t
17 // byte *bloque;
18 dword sector_actual;
19 fat12_entry_ext_t datos;
20 dword fd; //File descriptor
21 dword offset; //Offset absoluto (al comienzo)
22 dword offset_rel; //Offset relativo al sector actual
23 dword sectores; //Cantidad de sectores que ocupa el archivo
24 struct file_opened_t *next;
25 }file_opened_t;
27 ssize_t read (int fd, void *buf, size_t len);
28 int open (char *nombre);
29 int close (int fd);
30 int lseek (int fd, int offset, int donde);
32 #define SEEK_CUR 1
33 #define SEEK_SET 2
34 #define SEEK_END 3
36 #define DRIVE_0 0
37 #define FAT12 0
39 struct file
41 byte device; // Tipo de dispositivo donde se encuentra el archivo
42 byte fs; // tipo de filesystem
43 dword sector_origen;// Sector donde comienza el archivo en el dispositivo device con filesystem fs
44 dword sector_actual;
45 dword offset; // offset desde el comienzo del archivo
46 dword offset_rel; // offset desde el sector sobre el que esta parado
47 dword sectores; // cantidad de sectores totales
48 dword size;
49 };
51 #define MAX_FILES_POR_TAREA 5
53 #endif