wimlib
 All Files Functions Typedefs Enumerations Enumerator Defines
wimlib.h
Go to the documentation of this file.
00001 /*
00002  * wimlib.h
00003  *
00004  * External header for wimlib.
00005  *
00006  * Copyright (C) 2012 Eric Biggers
00007  *
00008  * wimlib - Library for working with WIM files 
00009  *
00010  * This library is free software; you can redistribute it and/or modify it under
00011  * the terms of the GNU Lesser General Public License as published by the Free
00012  * Software Foundation; either version 2.1 of the License, or (at your option) any
00013  * later version.
00014  *
00015  * This library is distributed in the hope that it will be useful, but WITHOUT ANY
00016  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
00017  * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public License along
00020  * with this library; if not, write to the Free Software Foundation, Inc., 59
00021  * Temple Place, Suite 330, Boston, MA 02111-1307 USA 
00022  */
00023 
00189 #ifndef _WIMLIB_H
00190 #define _WIMLIB_H
00191 
00192 #include <stdio.h>
00193 #include <stddef.h>
00194 #include <stdbool.h>
00195 
00196 #ifndef _WIMLIB_INTERNAL_H
00197 
00200 typedef struct WIMStruct WIMStruct;
00201 #endif
00202 
00207 enum wim_link_type {
00209         WIM_LINK_TYPE_HARD = 0,
00211         WIM_LINK_TYPE_SYMBOLIC = 1,
00214         WIM_LINK_TYPE_NONE = 2,
00215 };
00216 
00221 enum wim_compression_type {
00223         WIM_COMPRESSION_TYPE_INVALID = -1,
00224 
00226         WIM_COMPRESSION_TYPE_NONE = 0,
00227 
00229         WIM_COMPRESSION_TYPE_LZX = 1,
00230 
00232         WIM_COMPRESSION_TYPE_XPRESS = 2,
00233 };
00234 
00236 #define WIMLIB_MOUNT_FLAG_READWRITE             0x1
00237 
00239 #define WIMLIB_MOUNT_FLAG_DEBUG                 0x2
00240 
00243 #define WIMLIB_UNMOUNT_FLAG_CHECK_INTEGRITY     0x1
00244 
00247 #define WIMLIB_UNMOUNT_FLAG_COMMIT              0x2
00248 
00250 #define WIMLIB_WRITE_FLAG_CHECK_INTEGRITY       0x1
00251 
00253 #define WIMLIB_WRITE_FLAG_SHOW_PROGRESS         0x2
00254 
00256 #define WIMLIB_ADD_IMAGE_FLAG_BOOT              0x1
00257 
00259 #define WIMLIB_EXPORT_FLAG_BOOT                 0x1
00260 
00262 #define WIMLIB_OPEN_FLAG_CHECK_INTEGRITY        0x1
00263 
00265 #define WIMLIB_OPEN_FLAG_SHOW_PROGRESS          0x2
00266 
00273 enum wimlib_error_code {
00274         WIMLIB_ERR_SUCCESS = 0,
00275         WIMLIB_ERR_COMPRESSED_LOOKUP_TABLE,
00276         WIMLIB_ERR_DECOMPRESSION,
00277         WIMLIB_ERR_DELETE_STAGING_DIR,
00278         WIMLIB_ERR_FORK,
00279         WIMLIB_ERR_FUSE,
00280         WIMLIB_ERR_FUSERMOUNT,
00281         WIMLIB_ERR_IMAGE_COUNT,
00282         WIMLIB_ERR_IMAGE_NAME_COLLISION,
00283         WIMLIB_ERR_INTEGRITY,
00284         WIMLIB_ERR_INVALID_CHUNK_SIZE,
00285         WIMLIB_ERR_INVALID_COMPRESSION_TYPE,
00286         WIMLIB_ERR_INVALID_DENTRY,
00287         WIMLIB_ERR_INVALID_HEADER_SIZE,
00288         WIMLIB_ERR_INVALID_IMAGE,
00289         WIMLIB_ERR_INVALID_INTEGRITY_TABLE,
00290         WIMLIB_ERR_INVALID_PARAM,
00291         WIMLIB_ERR_INVALID_RESOURCE_SIZE,
00292         WIMLIB_ERR_LINK,
00293         WIMLIB_ERR_MKDIR,
00294         WIMLIB_ERR_MQUEUE,
00295         WIMLIB_ERR_NOMEM,
00296         WIMLIB_ERR_NOTDIR,
00297         WIMLIB_ERR_NOT_A_WIM_FILE,
00298         WIMLIB_ERR_NO_FILENAME,
00299         WIMLIB_ERR_OPEN,
00300         WIMLIB_ERR_OPENDIR,
00301         WIMLIB_ERR_READ,
00302         WIMLIB_ERR_RENAME,
00303         WIMLIB_ERR_SPLIT,
00304         WIMLIB_ERR_STAT,
00305         WIMLIB_ERR_TIMEOUT,
00306         WIMLIB_ERR_UNKNOWN_VERSION,
00307         WIMLIB_ERR_UNSUPPORTED,
00308         WIMLIB_ERR_WRITE,
00309         WIMLIB_ERR_XML,
00310 };
00311 
00312 
00314 #define WIM_NO_IMAGE    0
00315 
00317 #define WIM_ALL_IMAGES  (-1)
00318 
00319 
00372 extern int wimlib_add_image(WIMStruct *wim, const char *dir, 
00373                             const char *name, const char *description, 
00374                             const char *flags_element, int flags);
00375 
00395 extern int wimlib_create_new_wim(int ctype, WIMStruct **wim_ret);
00396 
00423 extern int wimlib_delete_image(WIMStruct *wim, int image);
00424 
00482 extern int wimlib_export_image(WIMStruct *src_wim, int src_image, 
00483                         WIMStruct *dest_wim, const char *dest_name, 
00484                         const char *dest_description, int flags);
00485 
00526 extern int wimlib_extract_image(WIMStruct *wim, int image);
00527 
00541 extern int wimlib_extract_xml_data(WIMStruct *wim, FILE *fp);
00542 
00552 extern void wimlib_free(WIMStruct *wim);
00553 
00564 extern int wimlib_get_boot_idx(const WIMStruct *wim);
00565 
00576 extern int wimlib_get_compression_type(const WIMStruct *wim);
00577 
00589 extern const char *wimlib_get_compression_type_string(int ctype);
00590 
00601 extern const char *wimlib_get_error_string(enum wimlib_error_code code);
00602 
00615 extern const char *wimlib_get_image_description(const WIMStruct *wim, int image);
00616 
00628 extern const char *wimlib_get_image_name(const WIMStruct *wim, int image);
00629 
00630 
00640 extern int wimlib_get_num_images(const WIMStruct *wim);
00641 
00650 bool wimlib_has_integrity_table(const WIMStruct *wim);
00651 
00652 
00665 extern bool wimlib_image_name_in_use(const WIMStruct *wim, const char *name);
00666 
00716 extern int wimlib_mount(WIMStruct *wim, int image, const char *dir, int flags);
00717 
00784 extern int wimlib_open_wim(const char *wim_file, int flags, 
00785                            WIMStruct **wim_ret);
00786 
00818 extern int wimlib_overwrite(WIMStruct *wim, int flags);
00819 
00855 extern int wimlib_overwrite_xml_and_header(WIMStruct *wim, int flags);
00856 
00869 extern void wimlib_print_available_images(const WIMStruct *wim, int image);
00870 
00899 extern int wimlib_print_files(WIMStruct *wim, int image);
00900 
00910 extern void wimlib_print_header(const WIMStruct *wim);
00911 
00924 extern void wimlib_print_lookup_table(WIMStruct *wim);
00925 
00955 extern int wimlib_print_metadata(WIMStruct *wim, int image);
00956 
00968 extern void wimlib_print_wim_information(const WIMStruct *wim);
00969 
00989 extern int wimlib_resolve_image(WIMStruct *wim, const char *image_name_or_num);
00990 
01004 extern int wimlib_set_boot_idx(WIMStruct *wim, int boot_idx);
01005 
01024 extern int wimlib_set_image_descripton(WIMStruct *wim, int image, 
01025                                        const char *description);
01026 
01047 extern int wimlib_set_image_name(WIMStruct *wim, int image, const char *name);
01048 
01066 extern int wimlib_set_link_type(WIMStruct *wim, int link_type);
01067 
01093 int wimlib_set_memory_allocator(void *(*malloc_func)(size_t),
01094                                  void (*free_func)(void *),
01095                                  void *(*realloc_func)(void *, size_t));
01096 
01116 extern int wimlib_set_print_errors(bool show_messages);
01117 
01132 extern void wimlib_set_verbose(WIMStruct *wim, bool verbose);
01133 
01151 extern int wimlib_set_output_dir(WIMStruct *wim, const char *dir);
01152 
01209 extern int wimlib_unmount(const char *dir, int flags);
01210 
01254 extern int wimlib_write(WIMStruct *wim, const char *path, int image, int flags);
01255 
01256 
01257 
01258 #endif /* _WIMLIB_H */
01259