Subversion Repositories HelenOS

Rev

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

Rev 3386 Rev 4153
Line 45... Line 45...
45
 
45
 
46
#define dprintf(...)
46
#define dprintf(...)
47
 
47
 
48
#define VFS_FIRST   IPC_FIRST_USER_METHOD
48
#define VFS_FIRST   IPC_FIRST_USER_METHOD
49
 
49
 
50
#define IPC_METHOD_TO_VFS_OP(m) ((m) - VFS_FIRST)   
-
 
51
 
-
 
52
/* Basic types. */
50
/* Basic types. */
53
typedef int16_t fs_handle_t;
51
typedef int16_t fs_handle_t;
54
typedef int16_t dev_handle_t;
52
typedef int16_t dev_handle_t;
55
typedef uint32_t fs_index_t;
53
typedef uint32_t fs_index_t;
56
 
54
 
Line 79... Line 77...
79
    VFS_UNLINK,
77
    VFS_UNLINK,
80
    VFS_RENAME,
78
    VFS_RENAME,
81
    VFS_LAST_SRV,   /* keep this the last member of this enum */
79
    VFS_LAST_SRV,   /* keep this the last member of this enum */
82
} vfs_request_srv_t;
80
} vfs_request_srv_t;
83
 
81
 
84
 
-
 
85
/**
-
 
86
 * An instance of this structure is associated with a particular FS operation.
-
 
87
 * It tells VFS if the FS supports the operation or maybe if a default one
-
 
88
 * should be used.
-
 
89
 */
-
 
90
typedef enum {
-
 
91
    VFS_OP_NULL = 0,
-
 
92
    VFS_OP_DEFAULT,
-
 
93
    VFS_OP_DEFINED
-
 
94
} vfs_op_t;
-
 
95
 
-
 
96
#define FS_NAME_MAXLEN  20
82
#define FS_NAME_MAXLEN  20
97
 
83
 
98
/**
84
/**
99
 * A structure like this is passed to VFS by each individual FS upon its
85
 * A structure like this is passed to VFS by each individual FS upon its
100
 * registration. It assosiates a human-readable identifier with each
86
 * registration. It assosiates a human-readable identifier with each
101
 * registered FS. More importantly, through this structure, the FS announces
-
 
102
 * what operations it supports.
87
 * registered FS.
103
 */
88
 */
104
typedef struct {
89
typedef struct {
105
    /** Unique identifier of the fs. */
90
    /** Unique identifier of the fs. */
106
    char name[FS_NAME_MAXLEN + 1];
91
    char name[FS_NAME_MAXLEN + 1];
107
   
-
 
108
    /** Operations. */
-
 
109
    vfs_op_t ops[VFS_LAST_CLNT - VFS_FIRST];
-
 
110
} vfs_info_t;
92
} vfs_info_t;
111
 
93
 
112
/**
94
/**
113
 * A structure like this will be allocated for each registered file system.
95
 * A structure like this will be allocated for each registered file system.
114
 */
96
 */
Line 188... Line 170...
188
 * L_PARENT performs a lookup but returns the triplet of the parent node.
170
 * L_PARENT performs a lookup but returns the triplet of the parent node.
189
 * This flag may not be combined with any other lookup flag.
171
 * This flag may not be combined with any other lookup flag.
190
 */
172
 */
191
#define L_PARENT    64  
173
#define L_PARENT    64  
192
 
174
 
-
 
175
typedef enum vfs_node_type {
-
 
176
    VFS_NODE_UNKNOWN,
-
 
177
    VFS_NODE_FILE,
-
 
178
    VFS_NODE_DIRECTORY,
-
 
179
} vfs_node_type_t;
-
 
180
 
193
typedef struct {
181
typedef struct {
194
    vfs_triplet_t triplet;
182
    vfs_triplet_t triplet;
-
 
183
    vfs_node_type_t type;
195
    size_t size;
184
    size_t size;
196
    unsigned lnkcnt;
185
    unsigned lnkcnt;
197
} vfs_lookup_res_t;
186
} vfs_lookup_res_t;
198
 
187
 
199
/**
188
/**
Line 211... Line 200...
211
   
200
   
212
    /** Number of names this node has in the file system namespace. */
201
    /** Number of names this node has in the file system namespace. */
213
    unsigned lnkcnt;
202
    unsigned lnkcnt;
214
 
203
 
215
    link_t nh_link;     /**< Node hash-table link. */
204
    link_t nh_link;     /**< Node hash-table link. */
-
 
205
 
-
 
206
    vfs_node_type_t type;   /**< Partial info about the node type. */
-
 
207
 
216
    size_t size;        /**< Cached size if the node is a file. */
208
    size_t size;        /**< Cached size if the node is a file. */
217
 
209
 
218
    /**
210
    /**
219
     * Holding this rwlock prevents modifications of the node's contents.
211
     * Holding this rwlock prevents modifications of the node's contents.
220
     */
212
     */
Line 288... Line 280...
288
extern void vfs_file_delref(vfs_file_t *);
280
extern void vfs_file_delref(vfs_file_t *);
289
 
281
 
290
extern void vfs_node_addref(vfs_node_t *);
282
extern void vfs_node_addref(vfs_node_t *);
291
extern void vfs_node_delref(vfs_node_t *);
283
extern void vfs_node_delref(vfs_node_t *);
292
 
284
 
-
 
285
extern void vfs_process_pending_mount(void);
293
extern void vfs_register(ipc_callid_t, ipc_call_t *);
286
extern void vfs_register(ipc_callid_t, ipc_call_t *);
294
extern void vfs_mount(ipc_callid_t, ipc_call_t *);
287
extern void vfs_mount(ipc_callid_t, ipc_call_t *);
295
extern void vfs_open(ipc_callid_t, ipc_call_t *);
288
extern void vfs_open(ipc_callid_t, ipc_call_t *);
296
extern void vfs_close(ipc_callid_t, ipc_call_t *);
289
extern void vfs_close(ipc_callid_t, ipc_call_t *);
297
extern void vfs_read(ipc_callid_t, ipc_call_t *);
290
extern void vfs_read(ipc_callid_t, ipc_call_t *);