Subversion Repositories Kolibri OS

Rev

Rev 4874 | Go to most recent revision | Blame | Last modification | View Log | RSS feed

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