Subversion Repositories HelenOS

Rev

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

Rev 2590 Rev 2593
Line 54... Line 54...
54
    VFS_CREATE,
54
    VFS_CREATE,
55
    VFS_CLOSE,
55
    VFS_CLOSE,
56
    VFS_READ,
56
    VFS_READ,
57
    VFS_WRITE,
57
    VFS_WRITE,
58
    VFS_SEEK,
58
    VFS_SEEK,
-
 
59
    VFS_RENAME,
-
 
60
    VFS_UNLINK,
59
    VFS_LAST,       /* keep this the last member of the enum */
61
    VFS_LAST,       /* keep this the last member of the enum */
60
} vfs_request_t;
62
} vfs_request_t;
61
 
63
 
62
 
64
 
63
/**
65
/**
Line 128... Line 130...
128
 * Instances of this type represent an active, in-memory VFS node and any state
130
 * Instances of this type represent an active, in-memory VFS node and any state
129
 * which may be associated with it.
131
 * which may be associated with it.
130
 */
132
 */
131
typedef struct {
133
typedef struct {
132
    VFS_TRIPLET;        /**< Identity of the node. */
134
    VFS_TRIPLET;        /**< Identity of the node. */
133
    atomic_t refcnt;    /**< Usage counter. */
135
    unsigned refcnt;    /**< Usage counter. */
-
 
136
    link_t nh_link;     /**< Node hash-table link. */
134
} vfs_node_t;
137
} vfs_node_t;
135
 
138
 
136
/**
139
/**
137
 * Instances of this type represent an open file. If the file is opened by more
140
 * Instances of this type represent an open file. If the file is opened by more
138
 * than one task, there will be a separate structure allocated for each task.
141
 * than one task, there will be a separate structure allocated for each task.
139
 */
142
 */
140
typedef struct {
143
typedef struct {
141
    vfs_node_t *node;
144
    vfs_node_t *node;
142
   
145
   
143
    /** Number of file handles referencing this file. */
146
    /** Number of file handles referencing this file. */
144
    atomic_t refcnt;
147
    unsigned refcnt;
145
 
148
 
146
    /** Current position in the file. */
149
    /** Current position in the file. */
147
    off_t pos;
150
    off_t pos;
148
} vfs_file_t;
151
} vfs_file_t;
149
 
152
 
Line 164... Line 167...
164
 
167
 
165
extern atomic_t plb_futex;  /**< Futex protecting plb and plb_head. */
168
extern atomic_t plb_futex;  /**< Futex protecting plb and plb_head. */
166
extern uint8_t *plb;        /**< Path Lookup Buffer */
169
extern uint8_t *plb;        /**< Path Lookup Buffer */
167
extern link_t plb_head;     /**< List of active PLB entries. */
170
extern link_t plb_head;     /**< List of active PLB entries. */
168
 
171
 
-
 
172
extern atomic_t unlink_futex;   /**< VFS_{CREATE|OPEN|UNLINK} serialization. */
-
 
173
 
169
extern int vfs_grab_phone(int);
174
extern int vfs_grab_phone(int);
170
extern void vfs_release_phone(int);
175
extern void vfs_release_phone(int);
171
 
176
 
172
extern int fs_name_to_handle(char *, bool);
177
extern int fs_name_to_handle(char *, bool);
173
 
178
 
174
extern int vfs_lookup_internal(char *, size_t, vfs_triplet_t *, vfs_pair_t *);
179
extern int vfs_lookup_internal(char *, size_t, vfs_triplet_t *, vfs_pair_t *);
-
 
180
 
-
 
181
 
175
extern vfs_node_t *vfs_node_get(vfs_triplet_t *);
182
extern vfs_node_t *vfs_node_get(vfs_triplet_t *);
-
 
183
extern void vfs_node_put(vfs_node_t *);
-
 
184
 
-
 
185
extern bool vfs_files_init(void);
-
 
186
extern vfs_file_t *vfs_file_get(int);
-
 
187
extern int vfs_fd_alloc(void);
-
 
188
extern void vfs_fd_free(int);
-
 
189
 
-
 
190
extern void vfs_file_addref(vfs_file_t *);
-
 
191
extern void vfs_file_delref(vfs_file_t *);
-
 
192
 
-
 
193
extern void vfs_node_addref(vfs_node_t *);
-
 
194
extern void vfs_node_delref(vfs_node_t *);
176
 
195
 
177
#define MAX_OPEN_FILES  128 
196
#define MAX_OPEN_FILES  128 
178
 
197
 
179
extern void vfs_register(ipc_callid_t, ipc_call_t *);
198
extern void vfs_register(ipc_callid_t, ipc_call_t *);
180
extern void vfs_mount(ipc_callid_t, ipc_call_t *);
199
extern void vfs_mount(ipc_callid_t, ipc_call_t *);