1/*
2	Copyright 1999-2001, Be Incorporated.   All Rights Reserved.
3	This file may be used under the terms of the Be Sample Code License.
4*/
5#ifndef _DOSFS_ITER_H_
6#define _DOSFS_ITER_H_
7
8struct _nspace;
9
10/* csi keeps track of current cluster and sector info */
11struct csi
12{
13	struct _nspace *vol;
14	uint32	cluster;
15	uint32	sector;
16};
17
18int init_csi(struct _nspace *vol, uint32 cluster, uint32 sector, struct csi *csi);
19int iter_csi(struct csi *csi, int sectors);
20uint8 *csi_get_block(struct csi *csi);
21status_t csi_release_block(struct csi *csi);
22status_t csi_mark_block_dirty(struct csi *csi);
23status_t csi_read_blocks(struct csi *csi, uint8 *buffer, ssize_t len);
24status_t csi_write_blocks(struct csi *csi, uint8 *buffer, ssize_t len);
25status_t csi_write_block(struct csi *csi, uint8 *buffer);
26
27/* directory entry iterator */
28#define DIRI_MAGIC '!duM'
29struct diri
30{
31	uint32	magic;
32	struct csi csi;
33	uint32 starting_cluster;
34	uint32 current_index;
35	uint8 *current_block;
36};
37
38uint8 *diri_init(struct _nspace *vol, uint32 cluster, uint32 index, struct diri *diri);
39int diri_free(struct diri *diri);
40uint8 *diri_current_entry(struct diri *diri);
41uint8 *diri_next_entry(struct diri *diri);
42uint8 *diri_rewind(struct diri *diri);
43void diri_mark_dirty(struct diri *diri);
44
45int check_diri_magic(struct diri *t, char *funcname);
46
47#endif
48