EMILE/libiso9660/libiso9660.h

73 lines
2.0 KiB
C
Raw Normal View History

2005-11-12 19:12:13 +00:00
/*
*
* (c) 2005 Laurent Vivier <Laurent@lvivier.info>
2005-11-12 19:12:13 +00:00
*
*/
#ifndef __LIBISO9660_H__
#define __LIBISO9660_H__
#include <unistd.h>
#include <linux/iso_fs.h>
2005-11-21 22:07:17 +00:00
#include <libstream.h>
2005-11-13 19:43:28 +00:00
#define ISO9660_EXTENT_SIZE (2048)
2005-11-21 22:07:17 +00:00
typedef struct iso9660_VOLUME {
int ucs_level;
struct iso_primary_descriptor *descriptor;
device_io_t *device;
} iso9660_VOLUME;
2005-11-12 19:12:13 +00:00
typedef struct iso9660_DIR {
2005-11-21 22:07:17 +00:00
iso9660_VOLUME *volume;
2005-11-12 19:12:13 +00:00
int extent;
int len;
int index;
unsigned char buffer[ISO9660_EXTENT_SIZE];
2005-11-12 19:12:13 +00:00
} iso9660_DIR;
typedef struct iso9660_FILE {
2005-11-21 22:07:17 +00:00
iso9660_VOLUME *volume;
int base; /* first extent of the file */
int size; /* size of the file */
int offset;
int current;
unsigned char buffer[ISO9660_EXTENT_SIZE];
2005-11-12 19:12:13 +00:00
} iso9660_FILE;
static inline int isonum_721(char *p)
{
return ((p[0] & 0xff)
| ((p[1] & 0xff) << 8));
}
static inline int isonum_723(char *p)
{
return (isonum_721(p));
}
static inline int isonum_733(char *p)
{
return ((p[0] & 0xff) | ((p[1] & 0xff) << 8) |
((p[2] & 0xff) << 16) | ((p[3] & 0xff) << 24));
}
2005-11-21 22:07:17 +00:00
extern iso9660_VOLUME* iso9660_mount(device_io_t *device);
extern int iso9660_umount(iso9660_VOLUME *volume);
extern iso9660_DIR* iso9660_opendir(iso9660_VOLUME *, char *name);
extern iso9660_FILE* iso9660_open(iso9660_VOLUME *, char* pathname);
extern void iso9660_name(int ucs_level, char *buffer, struct iso_directory_record * idr);
extern struct iso_directory_record *iso9660_get_root_node(iso9660_VOLUME* volume);
2005-11-12 19:12:13 +00:00
extern int iso9660_closedir(iso9660_DIR *dir);
extern struct iso_directory_record *iso9660_readdir(iso9660_DIR *dir);
extern int iso9660_is_directory(struct iso_directory_record * idr);
2005-11-21 22:07:17 +00:00
extern struct iso_directory_record* iso9660_get_node(iso9660_VOLUME *volume, struct iso_directory_record *dirnode, char *path);
2005-11-12 19:12:13 +00:00
extern ssize_t iso9660_read(iso9660_FILE *file, void *buf, size_t count);
extern void iso9660_close(iso9660_FILE *file);
2005-11-21 22:07:17 +00:00
extern int iso9660_lseek(iso9660_FILE *file, long offset, int whence);
2005-11-23 00:10:15 +00:00
extern int iso9660_fstat(iso9660_FILE *file, struct stream_stat *buf);
2005-11-12 19:12:13 +00:00
#endif /* __LIBISO9660_H__ */