3 * (c) 2005-2009 Laurent Vivier <Laurent@vivier.eu>
5 * This file has been copied from EMILE, http://emile.sf.net
9 #include "libiso9660.h"
10 #include "libopenbios/bindings.h"
11 #include "libc/diskio.h"
13 #define offsetof(t,m) ((long)&(((t *)0)->m))
15 static void read_extent(iso9660_DIR
*dir
)
17 seek_io(dir
->volume
->fd
, dir
->extent
* ISOFS_BLOCK_SIZE
);
18 read_io(dir
->volume
->fd
, dir
->buffer
, ISOFS_BLOCK_SIZE
);
20 dir
->len
-= ISOFS_BLOCK_SIZE
;
25 struct iso_directory_record
*iso9660_readdir(iso9660_DIR
*dir
)
27 struct iso_directory_record
*idr
;
30 ISOFS_BLOCK_SIZE
- offsetof(struct iso_directory_record
, name
[0]))
38 idr
= (struct iso_directory_record
*) &dir
->buffer
[dir
->index
];
39 if (idr
->length
[0] == 0) {
44 idr
= (struct iso_directory_record
*) &dir
->buffer
[dir
->index
];
47 dir
->index
+= dir
->buffer
[dir
->index
];