2013-12-15 09:09:20 +01:00
|
|
|
|
|
|
|
#ifndef __KOS_IO_H__
|
|
|
|
#define __KOS_IO_H__
|
|
|
|
|
2015-09-06 10:56:26 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2013-12-15 09:09:20 +01:00
|
|
|
#pragma pack(push, 1)
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char sec;
|
|
|
|
char min;
|
|
|
|
char hour;
|
|
|
|
char rsv;
|
|
|
|
}detime_t;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
char day;
|
|
|
|
char month;
|
|
|
|
short year;
|
|
|
|
}dedate_t;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
unsigned attr;
|
|
|
|
unsigned flags;
|
|
|
|
union
|
|
|
|
{
|
|
|
|
detime_t ctime;
|
|
|
|
unsigned cr_time;
|
|
|
|
};
|
|
|
|
union
|
|
|
|
{
|
|
|
|
dedate_t cdate;
|
|
|
|
unsigned cr_date;
|
|
|
|
};
|
|
|
|
union
|
|
|
|
{
|
|
|
|
detime_t atime;
|
|
|
|
unsigned acc_time;
|
|
|
|
};
|
|
|
|
union
|
|
|
|
{
|
|
|
|
dedate_t adate;
|
|
|
|
unsigned acc_date;
|
|
|
|
};
|
|
|
|
union
|
|
|
|
{
|
|
|
|
detime_t mtime;
|
|
|
|
unsigned mod_time;
|
|
|
|
};
|
|
|
|
union
|
|
|
|
{
|
|
|
|
dedate_t mdate;
|
|
|
|
unsigned mod_date;
|
|
|
|
};
|
|
|
|
unsigned size;
|
|
|
|
unsigned size_high;
|
|
|
|
} fileinfo_t;
|
|
|
|
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
|
|
|
int create_file(const char *path);
|
|
|
|
int get_fileinfo(const char *path, fileinfo_t *info);
|
2016-11-30 23:22:54 +01:00
|
|
|
int set_fileinfo(const char *path, fileinfo_t *info);
|
2013-12-15 09:09:20 +01:00
|
|
|
int read_file(const char *path, void *buff,
|
|
|
|
size_t offset, size_t count, size_t *reads);
|
|
|
|
int write_file(const char *path,const void *buff,
|
|
|
|
size_t offset, size_t count, size_t *writes);
|
|
|
|
int set_file_size(const char *path, unsigned size);
|
2014-04-09 05:45:52 +02:00
|
|
|
void unpack(void* packed_data, void* unpacked_data) __attribute__((stdcall)) ;
|
2013-12-15 09:09:20 +01:00
|
|
|
|
|
|
|
static inline void set_cwd(const char* cwd)
|
|
|
|
{
|
|
|
|
__asm__ __volatile__(
|
|
|
|
"int $0x40"
|
|
|
|
::"a"(30),"b"(1),"c"(cwd));
|
|
|
|
};
|
|
|
|
|
2015-09-06 10:56:26 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2013-12-15 09:09:20 +01:00
|
|
|
#endif
|