Add type field to IsoFilesystem. Minor documentation.

This commit is contained in:
Vreixo Formoso 2008-01-19 17:17:50 +01:00
parent 0c1ea8cc7e
commit 0e87bf8792
6 changed files with 63 additions and 8 deletions

View File

@ -1663,6 +1663,7 @@ int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts,
goto fs_cleanup; goto fs_cleanup;
} }
strncpy(ifs->type, "iso ", 4);
ifs->data = data; ifs->data = data;
ifs->refcount = 1; ifs->refcount = 1;
ifs->get_root = ifs_get_root; ifs->get_root = ifs_get_root;

View File

@ -24,22 +24,58 @@ typedef IsoFilesystem IsoImageFilesystem;
int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts, int iso_image_filesystem_new(IsoDataSource *src, struct iso_read_opts *opts,
int msgid, IsoImageFilesystem **fs); int msgid, IsoImageFilesystem **fs);
/**
* Get the volset identifier for an existent image. The returned string belong
* to the IsoImageFilesystem and shouldn't be free() nor modified.
*/
const char *iso_image_fs_get_volset_id(IsoImageFilesystem *fs); const char *iso_image_fs_get_volset_id(IsoImageFilesystem *fs);
/**
* Get the volume identifier for an existent image. The returned string belong
* to the IsoImageFilesystem and shouldn't be free() nor modified.
*/
const char *iso_image_fs_get_volume_id(IsoImageFilesystem *fs); const char *iso_image_fs_get_volume_id(IsoImageFilesystem *fs);
/**
* Get the publisher identifier for an existent image. The returned string
* belong to the IsoImageFilesystem and shouldn't be free() nor modified.
*/
const char *iso_image_fs_get_publisher_id(IsoImageFilesystem *fs); const char *iso_image_fs_get_publisher_id(IsoImageFilesystem *fs);
/**
* Get the data preparer identifier for an existent image. The returned string
* belong to the IsoImageFilesystem and shouldn't be free() nor modified.
*/
const char *iso_image_fs_get_data_preparer_id(IsoImageFilesystem *fs); const char *iso_image_fs_get_data_preparer_id(IsoImageFilesystem *fs);
/**
* Get the system identifier for an existent image. The returned string belong
* to the IsoImageFilesystem and shouldn't be free() nor modified.
*/
const char *iso_image_fs_get_system_id(IsoImageFilesystem *fs); const char *iso_image_fs_get_system_id(IsoImageFilesystem *fs);
/**
* Get the application identifier for an existent image. The returned string
* belong to the IsoImageFilesystem and shouldn't be free() nor modified.
*/
const char *iso_image_fs_get_application_id(IsoImageFilesystem *fs); const char *iso_image_fs_get_application_id(IsoImageFilesystem *fs);
/**
* Get the copyright file identifier for an existent image. The returned string
* belong to the IsoImageFilesystem and shouldn't be free() nor modified.
*/
const char *iso_image_fs_get_copyright_file_id(IsoImageFilesystem *fs); const char *iso_image_fs_get_copyright_file_id(IsoImageFilesystem *fs);
/**
* Get the abstract file identifier for an existent image. The returned string
* belong to the IsoImageFilesystem and shouldn't be free() nor modified.
*/
const char *iso_image_fs_get_abstract_file_id(IsoImageFilesystem *fs); const char *iso_image_fs_get_abstract_file_id(IsoImageFilesystem *fs);
/**
* Get the biblio file identifier for an existent image. The returned string
* belong to the IsoImageFilesystem and shouldn't be free() nor modified.
*/
const char *iso_image_fs_get_biblio_file_id(IsoImageFilesystem *fs); const char *iso_image_fs_get_biblio_file_id(IsoImageFilesystem *fs);
#endif /*LIBISO_FS_IMAGE_H_*/ #endif /*LIBISO_FS_IMAGE_H_*/

View File

@ -629,6 +629,7 @@ int iso_local_filesystem_new(IsoFilesystem **fs)
} }
/* fill struct */ /* fill struct */
strncpy(lfs->type, "file", 4);
lfs->refcount = 1; lfs->refcount = 1;
lfs->data = NULL; /* we don't need private data */ lfs->data = NULL; /* we don't need private data */
lfs->get_root = lfs_get_root; lfs->get_root = lfs_get_root;

View File

@ -26,6 +26,7 @@
typedef struct Iso_File_Source IsoFileSource; typedef struct Iso_File_Source IsoFileSource;
typedef struct Iso_Filesystem IsoFilesystem; typedef struct Iso_Filesystem IsoFilesystem;
typedef struct IsoFileSource_Iface IsoFileSourceIface;
/** /**
* See IsoFilesystem->get_id() for info about this. * See IsoFilesystem->get_id() for info about this.
@ -51,6 +52,12 @@ extern unsigned int iso_fs_global_id;
*/ */
struct Iso_Filesystem struct Iso_Filesystem
{ {
/**
* Type of filesystem.
* "file" -> local filesystem
* "iso " -> iso image filesystem
*/
char type[4];
/** /**
* Get the root of a filesystem. * Get the root of a filesystem.
@ -123,7 +130,7 @@ struct Iso_Filesystem
void *data; void *data;
}; };
typedef struct IsoFileSource_Iface struct IsoFileSource_Iface
{ {
/** /**
@ -306,7 +313,7 @@ typedef struct IsoFileSource_Iface
* TODO #00004 Add a get_mime_type() function. * TODO #00004 Add a get_mime_type() function.
* This can be useful for GUI apps, to choose the icon of the file * This can be useful for GUI apps, to choose the icon of the file
*/ */
} IsoFileSourceIface; };
struct Iso_File_Source struct Iso_File_Source
{ {
@ -492,7 +499,15 @@ int iso_file_source_readlink(IsoFileSource *src, char *buf, size_t bufsiz);
*/ */
IsoFilesystem* iso_file_source_get_filesystem(IsoFileSource *src); IsoFilesystem* iso_file_source_get_filesystem(IsoFileSource *src);
/**
* Take a ref to the given IsoFilesystem
*/
void iso_filesystem_ref(IsoFilesystem *fs); void iso_filesystem_ref(IsoFilesystem *fs);
/**
* Drop your ref to the given IsoFilesystem, evetually freeing associated
* resources.
*/
void iso_filesystem_unref(IsoFilesystem *fs); void iso_filesystem_unref(IsoFilesystem *fs);
/** /**

View File

@ -93,11 +93,13 @@ enum iso_replace_mode {
*/ */
}; };
typedef struct ecma119_write_opts Ecma119WriteOpts;
/** /**
* Holds the options for the image generation. * Holds the options for the image generation.
*/ */
typedef struct struct ecma119_write_opts {
{
int level; /**< ISO level to write at. */ int level; /**< ISO level to write at. */
/** Which extensions to support. */ /** Which extensions to support. */
@ -252,9 +254,9 @@ typedef struct
* buffer. * buffer.
*/ */
size_t fifo_size; size_t fifo_size;
} Ecma119WriteOpts; };
typedef struct Iso_Data_Source IsoDataSource; typedef struct iso_data_source IsoDataSource;
/** /**
* Data source used by libisofs for reading an existing image. * Data source used by libisofs for reading an existing image.
@ -268,7 +270,7 @@ typedef struct Iso_Data_Source IsoDataSource;
* it with regular .iso images, and also with block devices that represent a * it with regular .iso images, and also with block devices that represent a
* drive. * drive.
*/ */
struct Iso_Data_Source { struct iso_data_source {
/** /**
* Reference count for the data source. Should be 1 when a new source * Reference count for the data source. Should be 1 when a new source

View File

@ -530,7 +530,7 @@ int iso_dir_iter_remove(IsoDirIter *iter)
} }
/** /**
* Get the destination of a node (in UTF-8). * Get the destination of a node.
* The returned string belongs to the node and should not be modified nor * The returned string belongs to the node and should not be modified nor
* freed. Use strdup if you really need your own copy. * freed. Use strdup if you really need your own copy.
*/ */