libddk: fixed io functions

git-svn-id: svn://kolibrios.org@9186 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
turbocat 2021-09-10 18:50:14 +00:00
parent cf3af4b4ed
commit 80647f2201
4 changed files with 20 additions and 22 deletions

View File

@ -2,11 +2,13 @@
int create_file(const char *path) int create_file(const char *path)
{ {
int err=0; int err;
ksys70_t k; ksys70_t k;
k.p00 = 2; k.p00 = 2;
k.p12 = 0; k.p04dw = 0;
k.p20 = 0; k.p08dw = 0;
k.p21 = path; k.p12 = 0;
k.p20 = 0;
k.p21 = path;
return FS_Service(&k, &err); return FS_Service(&k, &err);
}; };

View File

@ -57,12 +57,14 @@ typedef struct
int get_fileinfo(const char *path, FILEINFO *info) int get_fileinfo(const char *path, FILEINFO *info)
{ {
ksys70_t k; int err;
int err; ksys70_t k;
k.p00 = 5; k.p00 = 5;
k.bdfe = info; k.p04dw = 0;
k.p20 = 0; k.p08dw = 0;
k.p21 = path; k.p12 = 0;
k.bdfe = info;
k.p20 = 0;
k.p21 = path;
return FS_Service(&k, &err); return FS_Service(&k, &err);
} }

View File

@ -2,9 +2,9 @@
int set_file_size(const char *path, unsigned size) int set_file_size(const char *path, unsigned size)
{ {
ksys70_t k; ksys70_t k;
int err; int err;
k.p00 = 4; k.p00 = 4;
k.p04dw = size; k.p04dw = size;
k.p08dw = 0; k.p08dw = 0;
k.p20 = 0; k.p20 = 0;

View File

@ -10,11 +10,5 @@ int write_file(const char *path,const void *buff,
k.cbuf16 = buff; k.cbuf16 = buff;
k.p20 = 0; k.p20 = 0;
k.p21 = path; k.p21 = path;
int status; return FS_Service(&k, writes);
unsigned bytes_written_v;
FS_Service(&k, &bytes_written_v);
if (!status){
*writes = bytes_written_v;
}
return status;
} }