Subversion Repositories Kolibri OS

Rev

Rev 6727 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6727 Rev 6775
Line 1... Line 1...
1
/*
1
/*
2
Kolibri OS port for gcc 5.4
2
Kolibri OS port for gcc 5.4
Line 3... Line 3...
3
 
3
 
Line 4... Line 4...
4
Started by Siemargl @Nov 2016
4
Started by Siemargl @Nov 2016
5
 
5
 
6
Contains realisation of directory handling functions:
6
Contains realization of directory handling functions:
7
    mkdir()
7
    mkdir()
8
    closedir()
8
    closedir()
9
    opendir()
9
    opendir()
Line 18... Line 18...
18
#include 
18
#include 
19
#include 
19
#include 
20
#include 
20
#include 
21
#include 
21
#include 
22
#include "kos32sys1.h"
22
#include "kos32sys1.h"
-
 
23
#include "sys/kos_io.h"
Line 23... Line 24...
23
 
24
 
24
/* defined in newlib headers
25
/* defined in newlib headers
Line 25... Line 26...
25
int	_EXFUN(mkdir,( const char *_path, mode_t __mode ));
26
int	_EXFUN(mkdir,( const char *_path, mode_t __mode ));
Line 145... Line 146...
145
int	mkdir(const char *_path, mode_t m)
146
int	mkdir(const char *_path, mode_t m)
146
{
147
{
147
    char   namebuffer[1050]; // need for save data after di!!!
148
    char   namebuffer[1050]; // need for save data after di!!!
148
    struct fs_dirinfo *di = (struct fs_dirinfo *)namebuffer;
149
    struct fs_dirinfo *di = (struct fs_dirinfo *)namebuffer;
Line 149... Line 150...
149
 
150
 
150
debug_board_printf("mkdir start (%s)\n", _path);
151
//debug_board_printf("mkdir start (%s)\n", _path);
151
    memset(di, 0, sizeof(struct fs_dirinfo));
152
    memset(di, 0, sizeof(struct fs_dirinfo));
152
    //di.ppath = (char*)_path;  // dont work with 70.9
153
    //di.ppath = (char*)_path;  // dont work with 70.9
Line 153... Line 154...
153
    strcpy(di->path, _path);
154
    strcpy(di->path, _path);
Line 157... Line 158...
157
        fprintf(stderr, "Error %d creating dir item %s\n", rc, _path);
158
        fprintf(stderr, "Error %d creating dir item %s\n", rc, _path);
158
        errno = rc;
159
        errno = rc;
159
        return -1;
160
        return -1;
160
    }
161
    }
Line 161... Line 162...
161
 
162
 
162
debug_board_printf("mkdir end (%s)\n", _path);
163
//debug_board_printf("mkdir end (%s)\n", _path);
163
    return 0;
164
    return 0;
Line 164... Line 165...
164
}
165
}
165
 
166
 
Line 228... Line 229...
228
    debug_board_printf("Loaded dir [%s] etnries %d,\n first file [%s]\n", name, ((struct fs_dirheader*)(retdir))->curn_blocks, ((struct fsBDFE*)(retdir+32))->fname);
229
    debug_board_printf("Loaded dir [%s] etnries %d,\n first file [%s]\n", name, ((struct fs_dirheader*)(retdir))->curn_blocks, ((struct fsBDFE*)(retdir+32))->fname);
Line 229... Line 230...
229
 
230
 
230
    return retdir;
231
    return retdir;
231
}
232
}
-
 
233
*/
-
 
234
 
-
 
235
// while not in newlib
-
 
236
int set_fileinfo(const char *path, fileinfo_t *info)
-
 
237
{
-
 
238
    int retval;
-
 
239
 
-
 
240
    __asm__ __volatile__ (
-
 
241
    "pushl $0 \n\t"
-
 
242
    "pushl $0 \n\t"
-
 
243
    "movl %1, 1(%%esp) \n\t"
-
 
244
    "pushl %%ebx \n\t"
-
 
245
    "pushl $0 \n\t"
-
 
246
    "pushl $0 \n\t"
-
 
247
    "pushl $0 \n\t"
-
 
248
    "pushl $6 \n\t"
-
 
249
    "movl %%esp, %%ebx \n\t"
-
 
250
    "movl $70, %%eax \n\t"
-
 
251
    "int $0x40 \n\t"
-
 
252
    "addl $28, %%esp \n\t"
-
 
253
    :"=a" (retval)
-
 
254
    :"r" (path), "b" (info));
-
 
255
   return retval;
-
 
256
};