Subversion Repositories HelenOS

Rev

Rev 2700 | Rev 2710 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2700 Rev 2707
Line 35... Line 35...
35
#include <vfs.h>
35
#include <vfs.h>
36
#include <stdlib.h>
36
#include <stdlib.h>
37
#include <unistd.h>
37
#include <unistd.h>
38
#include <dirent.h>
38
#include <dirent.h>
39
#include <fcntl.h>
39
#include <fcntl.h>
-
 
40
#include <sys/stat.h>
-
 
41
#include <sys/types.h>
40
#include <ipc/ipc.h>
42
#include <ipc/ipc.h>
41
#include <ipc/services.h>
43
#include <ipc/services.h>
42
#include <async.h>
44
#include <async.h>
43
#include <atomic.h>
45
#include <atomic.h>
44
#include <futex.h>
46
#include <futex.h>
Line 129... Line 131...
129
int open(const char *path, int oflag, ...)
131
int open(const char *path, int oflag, ...)
130
{
132
{
131
    return _open(path, L_FILE, oflag);
133
    return _open(path, L_FILE, oflag);
132
}
134
}
133
 
135
 
-
 
136
int close(int fildes)
-
 
137
{
-
 
138
    return 0;   /* TODO */
-
 
139
}
-
 
140
 
134
ssize_t read(int fildes, void *buf, size_t nbyte)
141
ssize_t read(int fildes, void *buf, size_t nbyte)
135
{
142
{
136
    int res;
143
    int res;
137
    ipcarg_t rc;
144
    ipcarg_t rc;
138
    ipc_call_t answer;
145
    ipc_call_t answer;
Line 207... Line 214...
207
        }
214
        }
208
    }
215
    }
209
       
216
       
210
    off_t newoffs;
217
    off_t newoffs;
211
    rc = async_req_3_1(vfs_phone, VFS_SEEK, fildes, offset, whence,
218
    rc = async_req_3_1(vfs_phone, VFS_SEEK, fildes, offset, whence,
212
        &newoffs);
219
        (ipcarg_t)&newoffs);
213
 
220
 
214
    async_serialize_end();
221
    async_serialize_end();
215
    futex_up(&vfs_phone_futex);
222
    futex_up(&vfs_phone_futex);
216
 
223
 
217
    if (rc != EOK)
224
    if (rc != EOK)
Line 272... Line 279...
272
    (void) close(dirp->fd);
279
    (void) close(dirp->fd);
273
    free(dirp);
280
    free(dirp);
274
    return 0;
281
    return 0;
275
}
282
}
276
 
283
 
277
int close(int fildes)
284
int mkdir(const char *path, mode_t mode)
278
{
285
{
-
 
286
    int res;
-
 
287
    ipcarg_t rc;
-
 
288
    ipc_call_t answer;
-
 
289
    aid_t req;
-
 
290
   
-
 
291
    futex_down(&vfs_phone_futex);
-
 
292
    async_serialize_start();
-
 
293
    if (vfs_phone < 0) {
-
 
294
        res = vfs_connect();
-
 
295
        if (res < 0) {
-
 
296
            async_serialize_end();
-
 
297
            futex_up(&vfs_phone_futex);
-
 
298
            return res;
-
 
299
        }
-
 
300
    }
-
 
301
    req = async_send_1(vfs_phone, VFS_MKDIR, mode, &answer);
-
 
302
    rc = ipc_data_write_start(vfs_phone, path, strlen(path));
-
 
303
    if (rc != EOK) {
-
 
304
        async_wait_for(req, NULL);
-
 
305
        async_serialize_end();
-
 
306
        futex_up(&vfs_phone_futex);
-
 
307
        return (int) rc;
-
 
308
    }
-
 
309
    async_wait_for(req, &rc);
-
 
310
    async_serialize_end();
-
 
311
    futex_up(&vfs_phone_futex);
279
    return 0;   /* TODO */
312
    return EOK;
280
}
313
}
281
 
314
 
282
/** @}
315
/** @}
283
 */
316
 */