diff --git a/src/image.h b/src/image.h index 1b7e73b..6d6af0e 100644 --- a/src/image.h +++ b/src/image.h @@ -22,14 +22,40 @@ * [The stuff we have in init belongs really to image!] */ -typedef struct Iso_Image_Rec_Opts IsoImageRecOpts; - -/** - * Options for recursive directory addition - */ -struct Iso_Image_Rec_Opts +struct Iso_Image { + int refcount; + + IsoDir *root; + + char *volset_id; + + char *volume_id; /**< Volume identifier. */ + char *publisher_id; /**< Volume publisher. */ + char *data_preparer_id; /**< Volume data preparer. */ + char *system_id; /**< Volume system identifier. */ + char *application_id; /**< Volume application id */ + char *copyright_file_id; + char *abstract_file_id; + char *biblio_file_id; + + /* el-torito boot catalog */ + struct el_torito_boot_catalog *bootcat; + + /* image identifier, for message origin identifier */ + int id; + + /** + * Default filesystem to use when adding files to the image tree. + */ + IsoFilesystem *fs; + + /* + * Default builder to use when adding files to the image tree. + */ + IsoNodeBuilder *builder; + /** * Whether to follow symlinks or just add them as symlinks */ @@ -77,44 +103,4 @@ struct Iso_Image_Rec_Opts int (*report)(IsoFileSource *src); }; -struct Iso_Image -{ - - int refcount; - - IsoDir *root; - - char *volset_id; - - char *volume_id; /**< Volume identifier. */ - char *publisher_id; /**< Volume publisher. */ - char *data_preparer_id; /**< Volume data preparer. */ - char *system_id; /**< Volume system identifier. */ - char *application_id; /**< Volume application id */ - char *copyright_file_id; - char *abstract_file_id; - char *biblio_file_id; - - /* el-torito boot catalog */ - struct el_torito_boot_catalog *bootcat; - - /* image identifier, for message origin identifier */ - int id; - - /** - * Default filesystem to use when adding files to the image tree. - */ - IsoFilesystem *fs; - - /* - * Default builder to use when adding files to the image tree. - */ - IsoNodeBuilder *builder; - - /** - * Options for recursive directory addition - */ - IsoImageRecOpts recOpts; -}; - #endif /*LIBISO_IMAGE_H_*/ diff --git a/src/tree.c b/src/tree.c index 9f4dec2..7142d08 100644 --- a/src/tree.c +++ b/src/tree.c @@ -303,7 +303,7 @@ int iso_tree_add_new_special(IsoDir *parent, const char *name, mode_t mode, */ void iso_tree_set_follow_symlinks(IsoImage *image, int follow) { - image->recOpts.follow_symlinks = follow ? 1 : 0; + image->follow_symlinks = follow ? 1 : 0; } /** @@ -313,7 +313,7 @@ void iso_tree_set_follow_symlinks(IsoImage *image, int follow) */ int iso_tree_get_follow_symlinks(IsoImage *image) { - return image->recOpts.follow_symlinks; + return image->follow_symlinks; } /** @@ -322,7 +322,7 @@ int iso_tree_get_follow_symlinks(IsoImage *image) */ void iso_tree_set_ignore_hidden(IsoImage *image, int skip) { - image->recOpts.ignore_hidden = skip ? 1 : 0; + image->ignore_hidden = skip ? 1 : 0; } /** @@ -332,7 +332,7 @@ void iso_tree_set_ignore_hidden(IsoImage *image, int skip) */ int iso_tree_get_ignore_hidden(IsoImage *image) { - return image->recOpts.ignore_hidden; + return image->ignore_hidden; } /** @@ -349,7 +349,7 @@ int iso_tree_get_ignore_hidden(IsoImage *image) */ void iso_tree_set_ignore_special(IsoImage *image, int skip) { - image->recOpts.ignore_special = skip & 0x0F; + image->ignore_special = skip & 0x0F; } /** @@ -359,7 +359,7 @@ void iso_tree_set_ignore_special(IsoImage *image, int skip) */ int iso_tree_get_ignore_special(IsoImage *image) { - return image->recOpts.ignore_special; + return image->ignore_special; } /** @@ -378,7 +378,7 @@ int iso_tree_get_ignore_special(IsoImage *image) void iso_tree_set_report_callback(IsoImage *image, int (*report)(IsoFileSource *src)) { - image->recOpts.report = report; + image->report = report; } static @@ -448,10 +448,10 @@ static int check_excludes(IsoImage *image, const char *path) { char **exclude; - if (image->recOpts.excludes == NULL) { + if (image->excludes == NULL) { return 0; } - exclude = image->recOpts.excludes; + exclude = image->excludes; while (*exclude) { if (strcmp(*exclude, path) == 0) { return 1; @@ -464,22 +464,22 @@ int check_excludes(IsoImage *image, const char *path) static int check_hidden(IsoImage *image, const char *name) { - return (image->recOpts.ignore_hidden && name[0] == '.'); + return (image->ignore_hidden && name[0] == '.'); } static int check_special(IsoImage *image, mode_t mode) { - if (image->recOpts.ignore_special != 0) { + if (image->ignore_special != 0) { switch(mode & S_IFMT) { case S_IFBLK: - return image->recOpts.ignore_special & 0x08 ? 1 : 0; + return image->ignore_special & 0x08 ? 1 : 0; case S_IFCHR: - return image->recOpts.ignore_special & 0x04 ? 1 : 0; + return image->ignore_special & 0x04 ? 1 : 0; case S_IFSOCK: - return image->recOpts.ignore_special & 0x02 ? 1 : 0; + return image->ignore_special & 0x02 ? 1 : 0; case S_IFIFO: - return image->recOpts.ignore_special & 0x01 ? 1 : 0; + return image->ignore_special & 0x01 ? 1 : 0; default: return 0; } @@ -532,7 +532,7 @@ int iso_add_dir_src_rec(IsoImage *image, IsoDir *parent, IsoFileSource *dir) path = iso_file_source_get_path(file); name = strrchr(path, '/') + 1; - if (image->recOpts.follow_symlinks) { + if (image->follow_symlinks) { ret = iso_file_source_stat(file, &info); } else { ret = iso_file_source_lstat(file, &info); @@ -556,7 +556,7 @@ int iso_add_dir_src_rec(IsoImage *image, IsoDir *parent, IsoFileSource *dir) goto dir_rec_continue; } - replace = image->recOpts.replace; + replace = image->replace; /* find place where to insert */ ret = iso_dir_exists(parent, name, &pos); @@ -574,8 +574,8 @@ int iso_add_dir_src_rec(IsoImage *image, IsoDir *parent, IsoFileSource *dir) } /* if we are here we must insert. Give user a chance for cancel */ - if (image->recOpts.report) { - int r = image->recOpts.report(file); + if (image->report) { + int r = image->report(file); if (r <= 0) { ret = (r < 0 ? ISO_CANCELED : ISO_SUCCESS); goto dir_rec_continue;