Subversion Repositories HelenOS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2433 jelen 1
/** @addtogroup FileLib
2
 * @{
3
 */
4
 
5
/**
6
 * @file    file.h
7
 * @brief   The main header for the user library for working with the file system
8
 */
9
 
10
#ifndef _FILE_H
11
#define _FILE_H
12
 
13
#include "../../../fs/const.h"
14
#include "../../../fs/type.h"
15
#include "../../../fs/stat.h"
16
#include "../../../fs/dir.h"
17
#include "../../../share/message.h"
18
 
19
#define F_OK            0x00
20
#define F_FILE_NOT_FOUND    0x01
21
#define F_FILE_NOT_OPEN     0x02
22
#define F_READ_ERROR        0x10
23
#define F_READ_OVERFLOW     0x11
24
#define F_SYSTEM_ERROR      0xf0
25
#define F_IPC_FAILURE       0xf1
26
#define F_MMAP_FAILURE      0xf2
27
#define F_COMM_FAILURE      0xf3
28
 
29
#define F_ERRTYPE_MASK      0xf0
30
 
31
#define F_MODE_READ     0x01
32
#define F_MODE_WRITE        0x02
33
#define F_MODE_READ_WRITE   F_MODE_READ | F_MODE_WRITE
34
#define F_MODE_APPEND       0x04
35
 
36
/**
37
*
38
*/
39
typedef struct {
40
    char name[30];
41
    unsigned short inode_num;
42
} dir_item_t;
43
 
44
/**
45
*
46
*/
47
typedef struct {
48
    size_t size;
49
    dir_item_t base_info;
50
    void *share;
51
    message_params_t *params;
52
    unsigned int handle;
53
    stat_t stat;
54
} file_t;
55
 
56
static int f_err;
57
 
58
/**
59
* a
60
*/
61
dir_item_t * ls(unsigned int * length);
62
 
63
/**
64
*
65
*/
66
int chdir(char * new_dir);
67
 
68
/**
69
*
70
*/
71
file_t * fopen (char * name, int mode);
72
 
73
/**
74
*
75
*/
76
int fstat(file_t * file);
77
 
78
/**
79
*
80
*/
81
int fread(file_t * file, void* buffer, unsigned int size);
82
 
83
/**
84
*
85
*/
86
int fseek(file_t * file, int offset, int whence);
87
 
88
/**
89
*
90
*/
91
int fclose(file_t * file);
92
 
93
#endif
94
 
95
/**
96
* }
97
*/