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
8
9#ifdef FS_SHELL
10#	include "system_dependencies.h"
11#else
12#	include <SupportDefs.h>
13#endif
14
15
16struct _nspace;
17
18/* csi keeps track of current cluster and sector info */
19struct csi {
20	struct _nspace *vol;
21	uint32	cluster;
22	uint32	sector;
23};
24
25off_t csi_to_block(struct csi *csi);
26int init_csi(struct _nspace *vol, uint32 cluster, uint32 sector, struct csi *csi);
27int iter_csi(struct csi *csi, int sectors);
28uint8 *csi_get_block(struct csi *csi);
29status_t csi_release_block(struct csi *csi);
30status_t csi_make_writable(struct csi *csi);
31status_t csi_read_blocks(struct csi *csi, uint8 *buffer, ssize_t len);
32status_t csi_write_blocks(struct csi *csi, uint8 *buffer, ssize_t len);
33status_t csi_write_block(struct csi *csi, uint8 *buffer);
34
35/* directory entry iterator */
36struct diri {
37	struct csi csi;
38	uint32 starting_cluster;
39	uint32 current_index;
40	uint8 *current_block;
41
42	diri();
43	~diri();
44};
45
46uint8 *diri_init(struct _nspace *vol, uint32 cluster, uint32 index, struct diri *diri);
47uint8 *diri_current_entry(struct diri *diri);
48uint8 *diri_next_entry(struct diri *diri);
49uint8 *diri_rewind(struct diri *diri);
50void diri_make_writable(struct diri *diri);
51
52#endif
53