Subversion Repositories Kolibri OS

Rev

Rev 5808 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5808 Rev 6777
1
#ifndef __KOS_IO_H__
1
#ifndef __KOS_IO_H__
2
#define __KOS_IO_H__
2
#define __KOS_IO_H__
3
 
3
 
4
#ifdef __cplusplus
4
#ifdef __cplusplus
5
extern "C" {
5
extern "C" {
6
#endif
6
#endif
7
 
7
 
8
#pragma pack(push, 1)
8
#pragma pack(push, 1)
9
typedef struct
9
typedef struct
10
{
10
{
11
  char sec;
11
  char sec;
12
  char min;
12
  char min;
13
  char hour;
13
  char hour;
14
  char rsv;
14
  char rsv;
15
}detime_t;
15
}detime_t;
16
 
16
 
17
typedef struct
17
typedef struct
18
{
18
{
19
  char  day;
19
  char  day;
20
  char  month;
20
  char  month;
21
  short year;
21
  short year;
22
}dedate_t;
22
}dedate_t;
23
 
23
 
24
typedef struct
24
typedef struct
25
{
25
{
26
  unsigned    attr;
26
  unsigned    attr;
27
  unsigned    flags;
27
  unsigned    flags;
28
  union
28
  union
29
  {
29
  {
30
     detime_t  ctime;
30
     detime_t  ctime;
31
     unsigned  cr_time;
31
     unsigned  cr_time;
32
  };
32
  };
33
  union
33
  union
34
  {
34
  {
35
     dedate_t  cdate;
35
     dedate_t  cdate;
36
     unsigned  cr_date;
36
     unsigned  cr_date;
37
  };
37
  };
38
  union
38
  union
39
  {
39
  {
40
     detime_t  atime;
40
     detime_t  atime;
41
     unsigned  acc_time;
41
     unsigned  acc_time;
42
  };
42
  };
43
  union
43
  union
44
  {
44
  {
45
     dedate_t  adate;
45
     dedate_t  adate;
46
     unsigned  acc_date;
46
     unsigned  acc_date;
47
  };
47
  };
48
  union
48
  union
49
  {
49
  {
50
     detime_t  mtime;
50
     detime_t  mtime;
51
     unsigned  mod_time;
51
     unsigned  mod_time;
52
  };
52
  };
53
  union
53
  union
54
  {
54
  {
55
     dedate_t  mdate;
55
     dedate_t  mdate;
56
     unsigned  mod_date;
56
     unsigned  mod_date;
57
  };
57
  };
58
  unsigned    size;
58
  unsigned    size;
59
  unsigned    size_high;
59
  unsigned    size_high;
60
} fileinfo_t;
60
} fileinfo_t;
61
 
61
 
62
#pragma pack(pop)
62
#pragma pack(pop)
63
 
63
 
64
int create_file(const char *path);
64
int create_file(const char *path);
65
int get_fileinfo(const char *path, fileinfo_t *info);
65
int get_fileinfo(const char *path, fileinfo_t *info);
66
int read_file(const char *path, void *buff,
66
int set_fileinfo(const char *path, fileinfo_t *info);
-
 
67
int read_file(const char *path, void *buff,
67
               size_t offset, size_t count, size_t *reads);
68
               size_t offset, size_t count, size_t *reads);
68
int write_file(const char *path,const void *buff,
69
int write_file(const char *path,const void *buff,
69
               size_t offset, size_t count, size_t *writes);
70
               size_t offset, size_t count, size_t *writes);
70
int set_file_size(const char *path, unsigned size);
71
int set_file_size(const char *path, unsigned size);
71
void unpack(void* packed_data, void* unpacked_data) __attribute__((stdcall)) ;
72
void unpack(void* packed_data, void* unpacked_data) __attribute__((stdcall)) ;
72
 
73
 
73
static inline void set_cwd(const char* cwd)
74
static inline void set_cwd(const char* cwd)
74
{
75
{
75
    __asm__ __volatile__(
76
    __asm__ __volatile__(
76
    "int $0x40"
77
    "int $0x40"
77
    ::"a"(30),"b"(1),"c"(cwd));
78
    ::"a"(30),"b"(1),"c"(cwd));
78
};
79
};
79
 
80
 
80
#ifdef __cplusplus
81
#ifdef __cplusplus
81
}
82
}
82
#endif
83
#endif
83
#endif
84
#endif