diff --git a/libisofs/libisofs.h b/libisofs/libisofs.h index cc186ca..0c70e78 100644 --- a/libisofs/libisofs.h +++ b/libisofs/libisofs.h @@ -1224,30 +1224,44 @@ int iso_write_opts_set_appendable(IsoWriteOpts *opts, int appendable); int iso_write_opts_set_ms_block(IsoWriteOpts *opts, uint32_t ms_block); /** - * Sets the buffer where to store the descriptors that need to be written - * at the beginning of a overwriteable media to grow the image. - * - * @param overwrite - * When not NULL, it should point to a buffer of at least 64KiB, where - * libisofs will write the contents that should be written at the - * beginning of a overwriteable media, to grow the image. The growing - * of an image is a way, used by first time in growisofs by Andy Polyakov, - * to allow the appending of new data to non-multisession media, such - * as DVD+RW, in the same way you append a new session to a multisession - * disc, i.e., without need to write again the contents of the previous - * image. - * - * Note that if you want this kind of image growing, you will also need to - * set appendable to "1" and provide a valid ms_block after the previous + * Sets the buffer where to store the descriptors which shall to be written + * at the beginning of an overwriteable media to point to the newly written * image. - * - * You should initialize the buffer either with 0s, or with the contents of - * the first blocks of the image you're growing. In most cases, 0 is good - * enought. - * - * If you don't need this information, for example because you're creating a - * new image from scratch of because you will create an image for a true - * multisession media, just don't set this buffer or set it to NULL. + * This is needed if the write start address of the image is not 0. + * In this case the first 64 KiB of the media have to be overwritten + * by the buffer content after the session was written and the buffer + * was updated by libisofs. Otherwise the new session would not be + * found by operating system function mount() or by libisoburn. + * (One could still mount that session if its start address is known.) + * + * If you do not need this information, for example because you are creating a + * new image for LBA 0 or because you will create an image for a true + * multisession media, just do not use this call or set buffer to NULL. + * + * Use cases: + * + * - Together with iso_write_opts_set_appendable(opts, 1) the buffer serves + * for the growing of an image as done in growisofs by Andy Polyakov. + * This allows appending of a new session to non-multisession media, such + * as DVD+RW. The new session will refer to the data of previous sessions + * on the same media. + * libisoburn emulates multisession appendability on overwriteable media + * and disk files by performing this use case. + * + * - Together with iso_write_opts_set_appendable(opts, 0) the buffer allows + * to write the first session on overwriteable media to start addresses + * other than 0. + * libisoburn in most cases writes the first session on overwriteable media + * and disk files to LBA 32 in order to preserve its descriptors from the + * subsequent overwriting by the descriptor buffer of later sessions. + * + * @param buffer + * When not NULL, it should point to at least 64KiB of memory, where + * libisofs will install the contents that shall be written at the + * beginning of overwriteable media. + * You should initialize the buffer either with 0s, or with the contents + * of the first 32 blocks of the image you are growing. In most cases, + * 0 is good enought. * * @since 0.6.2 */ @@ -2493,6 +2507,16 @@ int iso_file_get_sort_weight(IsoFile *file); */ off_t iso_file_get_size(IsoFile *file); +/** + * Get the device id (major/minor numbers) of the given block or + * character device file. The result is undefined for other kind + * of special files, of first be sure iso_node_get_mode() returns either + * S_IFBLK or S_IFCHR. + * + * @since 0.6.6 + */ +dev_t iso_special_get_dev(IsoSpecial *special); + /** * Get the IsoStream that represents the contents of the given IsoFile. * diff --git a/libisofs/node.c b/libisofs/node.c index 9c8dee9..f1b26f9 100644 --- a/libisofs/node.c +++ b/libisofs/node.c @@ -906,6 +906,19 @@ IsoStream *iso_file_get_stream(IsoFile *file) return file->stream; } +/** + * Get the device id (major/minor numbers) of the given block or + * character device file. The result is undefined for other kind + * of special files, of first be sure iso_node_get_mode() returns either + * S_IFBLK or S_IFCHR. + * + * @since 0.6.6 + */ +dev_t iso_special_get_dev(IsoSpecial *special) +{ + return special->dev; +} + /** * Get the block lba of a file node, if it was imported from an old image. * diff --git a/libisofs/rockridge_read.c b/libisofs/rockridge_read.c index 02dbc86..05b5b4f 100644 --- a/libisofs/rockridge_read.c +++ b/libisofs/rockridge_read.c @@ -414,6 +414,6 @@ int read_rr_PN(struct susp_sys_user_entry *pn, struct stat *st) } st->st_rdev = (dev_t)((dev_t)iso_read_bb(pn->data.PN.high, 4, NULL) << 32) - || (dev_t)iso_read_bb(pn->data.PN.low, 4, NULL); + | (dev_t)iso_read_bb(pn->data.PN.low, 4, NULL); return ISO_SUCCESS; } diff --git a/libisofs/tree.c b/libisofs/tree.c index 8daf7f6..d1c6feb 100644 --- a/libisofs/tree.c +++ b/libisofs/tree.c @@ -938,6 +938,7 @@ int iso_tree_path_to_node(IsoImage *image, const char *path, IsoNode **node) while (component) { if (n->type != LIBISO_DIR) { n = NULL; + result = 0; break; } dir = (IsoDir *)n;