]> wimlib.net Git - wimlib/commitdiff
Remove remaining DEBUG() messages
authorEric Biggers <ebiggers3@gmail.com>
Sun, 31 May 2015 21:43:14 +0000 (16:43 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Fri, 5 Jun 2015 03:45:35 +0000 (22:45 -0500)
12 files changed:
configure.ac
include/wimlib/error.h
src/blob_table.c
src/compress_parallel.c
src/dentry.c
src/error.c
src/header.c
src/integrity.c
src/metadata_resource.c
src/security.c
src/update_image.c
src/xml.c

index dbabc0e89df7b8e6b863a4d27fcbf3478ffe1cc4..6c24d53dae6028d010bd153f678c4a3ead70eb91 100644 (file)
@@ -242,16 +242,6 @@ AM_CONDITIONAL([ENABLE_SSSE3_SHA1], [test "$ENABLE_SSSE3_SHA1" = "yes"])
 
 # ----------------------------- Other options ---------------------------------
 
-AC_MSG_CHECKING([whether to include debugging messages])
-AC_ARG_ENABLE([debug],
-       AS_HELP_STRING([--enable-debug], [include debugging messages]),
-       [ENABLE_DEBUG=$enableval],
-       [ENABLE_DEBUG=no])
-AC_MSG_RESULT([$ENABLE_DEBUG])
-if test "$ENABLE_DEBUG" = "yes"; then
-       AC_DEFINE([ENABLE_DEBUG], [1], [Define to 1 if including debug messages])
-fi
-
 AC_MSG_CHECKING([whether to include error messages])
 AC_ARG_ENABLE([error_messages],
        AS_HELP_STRING([--disable-error-messages], [do not compile in error messsages]),
index 45e8f14ff8bf5c7164a44324270ae7c3f1a17592..06222a06f03050fd4c16cdd798a01ec2561ed1c1 100644 (file)
@@ -44,17 +44,6 @@ extern FILE *wimlib_error_file;
 #  define WARNING_WITH_ERRNO(format, ...)      dummy_tprintf(T(format), ## __VA_ARGS__)
 #endif /* !ENABLE_ERROR_MESSAGES */
 
-#ifdef ENABLE_DEBUG
-extern void
-wimlib_debug(const tchar *file, int line, const char *func,
-            const tchar *format, ...);
-#  define DEBUG(format, ...) \
-               wimlib_debug(T(__FILE__), __LINE__, __func__, T(format), ## __VA_ARGS__)
-
-#else
-#  define DEBUG(format, ...) dummy_tprintf(T(format), ## __VA_ARGS__)
-#endif /* !ENABLE_DEBUG */
-
 extern void
 print_byte_field(const u8 *field, size_t len, FILE *out);
 
index 29d44d9f031455ffca4c5b2180e3a720660da4e0..e9766b5f6419db7d1f35c4b79815a4169954a6ed 100644 (file)
@@ -632,17 +632,7 @@ do_load_solid_info(WIMStruct *wim, struct wim_resource_descriptor **rdescs,
                BUILD_BUG_ON(WIMLIB_COMPRESSION_TYPE_LZX != 2);
                BUILD_BUG_ON(WIMLIB_COMPRESSION_TYPE_LZMS != 3);
                rdesc->compression_type = le32_to_cpu(hdr.compression_format);
-
                rdesc->chunk_size = le32_to_cpu(hdr.chunk_size);
-
-               DEBUG("Solid resource %zu/%zu: %"PRIu64" => %"PRIu64" "
-                     "(%"TS"/%"PRIu32") @ +%"PRIu64"",
-                     i + 1, num_rdescs,
-                     rdesc->uncompressed_size,
-                     rdesc->size_in_wim,
-                     wimlib_get_compression_type_string(rdesc->compression_type),
-                     rdesc->chunk_size,
-                     rdesc->offset_in_wim);
        }
        return 0;
 }
@@ -859,8 +849,6 @@ read_blob_table(WIMStruct *wim)
        struct wim_resource_descriptor **cur_solid_rdescs = NULL;
        size_t cur_num_solid_rdescs = 0;
 
-       DEBUG("Reading blob table.");
-
        /* Calculate the number of entries in the blob table.  */
        num_entries = wim->hdr.blob_table_reshdr.uncompressed_size /
                      sizeof(struct blob_descriptor_disk);
@@ -887,13 +875,6 @@ read_blob_table(WIMStruct *wim)
                /* Get the resource header  */
                get_wim_reshdr(&disk_entry->reshdr, &reshdr);
 
-               DEBUG("reshdr: size_in_wim=%"PRIu64", "
-                     "uncompressed_size=%"PRIu64", "
-                     "offset_in_wim=%"PRIu64", "
-                     "flags=0x%02x",
-                     reshdr.size_in_wim, reshdr.uncompressed_size,
-                     reshdr.offset_in_wim, reshdr.flags);
-
                /* Ignore SOLID flag if it isn't supposed to be used in this WIM
                 * version.  */
                if (wim->hdr.wim_version == WIM_VERSION_DEFAULT)
@@ -1038,11 +1019,6 @@ read_blob_table(WIMStruct *wim)
                         * this overrides the actual locations of the metadata
                         * resources themselves in the WIM file as well as any
                         * information written in the XML data.  */
-                       DEBUG("Found metadata resource for image %"PRIu32" at "
-                             "offset %"PRIu64".",
-                             image_index + 1,
-                             reshdr.offset_in_wim);
-
                        wim->image_metadata[image_index++]->metadata_blob = cur_blob;
                } else {
                        /* Blob table entry for a non-metadata blob.  */
@@ -1094,7 +1070,6 @@ read_blob_table(WIMStruct *wim)
                        num_wrong_part_blobs);
        }
 
-       DEBUG("Done reading blob table.");
        wim->blob_table = table;
        ret = 0;
        goto out_free_buf;
@@ -1154,9 +1129,6 @@ write_blob_table_from_blob_list(struct list_head *blob_list,
                }
        }
 
-       DEBUG("Writing WIM blob table (size=%zu, offset=%"PRIu64")",
-             table_size, out_fd->offset);
-
        table_buf = MALLOC(table_size);
        if (table_buf == NULL) {
                ERROR("Failed to allocate %zu bytes for temporary blob table",
@@ -1215,7 +1187,6 @@ write_blob_table_from_blob_list(struct list_head *blob_list,
                                             NULL,
                                             write_resource_flags);
        FREE(table_buf);
-       DEBUG("ret=%d", ret);
        return ret;
 }
 
index 511ef1b84ee73451048c21020cf9af7845f4a8b9..6aa635bf669803e1ec2500336a0ab163d0d44977 100644 (file)
@@ -247,7 +247,6 @@ parallel_chunk_compressor_destroy(struct chunk_compressor *_ctx)
                return;
 
        if (ctx->num_started_threads != 0) {
-               DEBUG("Terminating %u compressor threads", ctx->num_started_threads);
                message_queue_terminate(&ctx->chunks_to_compress_queue);
 
                for (i = 0; i < ctx->num_started_threads; i++)
@@ -377,11 +376,8 @@ new_parallel_chunk_compressor(int out_ctype, u32 out_chunk_size,
        if (num_threads == 0)
                num_threads = get_available_cpus();
 
-       if (num_threads == 1) {
-               DEBUG("Only 1 thread; Not bothering with "
-                     "parallel chunk compressor.");
+       if (num_threads == 1)
                return -1;
-       }
 
        if (max_memory == 0)
                max_memory = get_available_memory();
@@ -433,11 +429,8 @@ new_parallel_chunk_compressor(int out_ctype, u32 out_chunk_size,
                        desired_num_threads, num_threads);
        }
 
-       if (num_threads == 1) {
-               DEBUG("Only 1 thread; Not bothering with "
-                     "parallel chunk compressor.");
+       if (num_threads == 1)
                return -2;
-       }
 
        ret = WIMLIB_ERR_NOMEM;
        ctx = CALLOC(1, sizeof(*ctx));
@@ -484,8 +477,6 @@ new_parallel_chunk_compressor(int out_ctype, u32 out_chunk_size,
             ctx->num_started_threads < num_threads;
             ctx->num_started_threads++)
        {
-               DEBUG("pthread_create thread %u of %u",
-                     ctx->num_started_threads + 1, num_threads);
                ret = pthread_create(&ctx->thread_data[ctx->num_started_threads].thread,
                                     NULL,
                                     compressor_thread_proc,
index 01945b2a33062b80b8a53f1c830ab8441d30795e..5c6f97566f74510eb460f84b8ff2792ce8a0fdb3 100644 (file)
@@ -1642,8 +1642,6 @@ read_dentry_tree(const u8 *buf, size_t buf_len,
        int ret;
        struct wim_dentry *root;
 
-       DEBUG("Reading dentry tree (root_offset=%"PRIu64")", root_offset);
-
        ret = read_dentry(buf, buf_len, &root_offset, &root);
        if (ret)
                return ret;
@@ -1890,10 +1888,6 @@ write_dir_dentries(struct wim_dentry *dir, void *_pp)
 u8 *
 write_dentry_tree(struct wim_dentry *root, u8 *p)
 {
-       DEBUG("Writing dentry tree.");
-
-       wimlib_assert(root != NULL);
-
        /* write root dentry and end-of-directory entry following it */
        p = write_dentry(root, p);
        *(u64*)p = 0;
index ed9e6b72be56772f444c58932c79054e888370d9..6e04a06ae1cd94f125307502844c9cdce437fa1e 100644 (file)
 bool wimlib_print_errors = false;
 FILE *wimlib_error_file = NULL; /* Set in wimlib_global_init() */
 static bool wimlib_owns_error_file = false;
-#endif
 
-#if defined(ENABLE_ERROR_MESSAGES) || defined(ENABLE_DEBUG)
 static void
 wimlib_vmsg(const tchar *tag, const tchar *format, va_list va, bool perror)
 {
-#ifndef ENABLE_DEBUG
        if (!wimlib_print_errors)
                return;
-#endif
        int errno_save = errno;
        fflush(stdout);
        tfputs(tag, wimlib_error_file);
@@ -82,9 +78,7 @@ wimlib_vmsg(const tchar *tag, const tchar *format, va_list va, bool perror)
        fflush(wimlib_error_file);
        errno = errno_save;
 }
-#endif
 
-#ifdef ENABLE_ERROR_MESSAGES
 void
 wimlib_error(const tchar *format, ...)
 {
@@ -124,22 +118,7 @@ wimlib_warning_with_errno(const tchar *format, ...)
        wimlib_vmsg(T("\r[WARNING] "), format, va, true);
        va_end(va);
 }
-
-#endif
-
-#ifdef ENABLE_DEBUG
-void wimlib_debug(const tchar *filename, int line, const char *func,
-                 const tchar *format, ...)
-{
-       va_list va;
-       tchar buf[tstrlen(filename) + strlen(func) + 30];
-
-       tsprintf(buf, T("[%"TS" %d] %s(): "), filename, line, func);
-       va_start(va, format);
-       wimlib_vmsg(buf, format, va, false);
-       va_end(va);
-}
-#endif
+#endif /* ENABLE_ERROR_MESSAGES */
 
 void
 print_byte_field(const u8 *field, size_t len, FILE *out)
index 37ba6ed260e1d14ab61c1f4edfbe0858bc9eb348..d5449507974292560824f3ff8c829e5ae8fdf07c 100644 (file)
@@ -78,8 +78,6 @@ read_wim_header(WIMStruct *wim, struct wim_header *hdr)
 
        BUILD_BUG_ON(sizeof(struct wim_header_disk) != WIM_HEADER_DISK_SIZE);
 
-       DEBUG("Reading WIM header from \"%"TS"\"", filename);
-
        ret = full_read(in_fd, &disk_hdr, sizeof(disk_hdr));
        if (ret)
                goto read_error;
@@ -135,9 +133,6 @@ read_wim_header(WIMStruct *wim, struct wim_header *hdr)
 
        hdr->image_count = le32_to_cpu(disk_hdr.image_count);
 
-       DEBUG("part_number = %u, total_parts = %u, image_count = %u",
-             hdr->part_number, hdr->total_parts, hdr->image_count);
-
        if (unlikely(hdr->image_count > MAX_IMAGES)) {
                ERROR("\"%"TS"\": Invalid image count (%u)",
                      filename, hdr->image_count);
@@ -166,10 +161,6 @@ write_wim_header(const struct wim_header *hdr, struct filedes *out_fd,
        struct wim_header_disk disk_hdr _aligned_attribute(8);
        int ret;
 
-       DEBUG("Writing %sWIM header at offset %"PRIu64,
-             ((hdr->magic == PWM_MAGIC) ? "pipable " : ""),
-             offset);
-
        disk_hdr.magic = cpu_to_le64(hdr->magic);
        disk_hdr.hdr_size = cpu_to_le32(sizeof(struct wim_header_disk));
        disk_hdr.wim_version = cpu_to_le32(hdr->wim_version);
index 2806708975ee41aad67137281ec96a19045268b0..0a7ea0fb7f704f30bec751fdd2afe6187abcc33e 100644 (file)
@@ -116,8 +116,6 @@ read_integrity_table(WIMStruct *wim, u64 num_checked_bytes,
        if (wim->hdr.integrity_table_reshdr.uncompressed_size < 8)
                goto invalid;
 
-       DEBUG("Reading integrity table.");
-
        ret = wim_reshdr_to_data(&wim->hdr.integrity_table_reshdr, wim, &buf);
        if (ret)
                return ret;
@@ -127,10 +125,6 @@ read_integrity_table(WIMStruct *wim, u64 num_checked_bytes,
        table->num_entries = le32_to_cpu(table->num_entries);
        table->chunk_size  = le32_to_cpu(table->chunk_size);
 
-       DEBUG("table->size = %u, table->num_entries = %u, "
-             "table->chunk_size = %u",
-             table->size, table->num_entries, table->chunk_size);
-
        if (table->size != wim->hdr.integrity_table_reshdr.uncompressed_size ||
            table->size != (u64)table->num_entries * SHA1_HASH_SIZE + 12 ||
            table->chunk_size == 0 ||
@@ -311,10 +305,6 @@ write_integrity_table(WIMStruct *wim,
        int ret;
        u32 new_table_size;
 
-       DEBUG("Writing integrity table "
-             "(new_blob_table_end=%"PRIu64", old_blob_table_end=%"PRIu64")",
-             new_blob_table_end, old_blob_table_end);
-
        wimlib_assert(old_blob_table_end <= new_blob_table_end);
 
        ret = calculate_integrity_table(&wim->out_fd, new_blob_table_end,
@@ -339,7 +329,6 @@ write_integrity_table(WIMStruct *wim,
                                             NULL,
                                             0);
        FREE(new_table);
-       DEBUG("ret=%d", ret);
        return ret;
 }
 
@@ -442,10 +431,8 @@ check_wim_integrity(WIMStruct *wim)
        struct integrity_table *table;
        u64 end_blob_table_offset;
 
-       if (!wim_has_integrity_table(wim)) {
-               DEBUG("No integrity information.");
+       if (!wim_has_integrity_table(wim))
                return WIM_INTEGRITY_NONEXISTENT;
-       }
 
        end_blob_table_offset = wim->hdr.blob_table_reshdr.offset_in_wim +
                                wim->hdr.blob_table_reshdr.size_in_wim;
index 2a3279494ad56c7f4fc68c2d82022d000491dc91..c0467ef69c8877799ce4866e195a02ec1e2081d1 100644 (file)
@@ -78,8 +78,6 @@ read_metadata_resource(struct wim_image_metadata *imd)
 
        metadata_blob = imd->metadata_blob;
 
-       DEBUG("Reading metadata resource (size=%"PRIu64").", metadata_blob->size);
-
        /* Read the metadata resource into memory.  (It may be compressed.)  */
        ret = read_blob_into_alloc_buf(metadata_blob, &buf);
        if (ret)
@@ -132,7 +130,6 @@ read_metadata_resource(struct wim_image_metadata *imd)
        imd->root_dentry = root;
        imd->security_data = sd;
        INIT_LIST_HEAD(&imd->unhashed_blobs);
-       DEBUG("Done parsing metadata resource.");
        return 0;
 
 out_free_dentry_tree:
@@ -166,8 +163,6 @@ prepare_metadata_resource(WIMStruct *wim, int image,
        struct wim_security_data *sd;
        struct wim_image_metadata *imd;
 
-       DEBUG("Preparing metadata resource for image %d", image);
-
        ret = select_wim_image(wim, image);
        if (ret)
                return ret;
index f160d683f6cbf4755bc92f8ef28b96fa9f8dfcb4..883402b0eae5931b6d8df7e4788a4b844e85a809 100644 (file)
@@ -87,9 +87,6 @@ read_wim_security_data(const u8 *buf, size_t buf_len,
        sd->total_length = le32_to_cpu(sd_disk->total_length);
        sd->num_entries = le32_to_cpu(sd_disk->num_entries);
 
-       DEBUG("Reading security data: num_entries=%u, total_length=%u",
-             sd->num_entries, sd->total_length);
-
        /* Length field of 0 is a special case that really means length
         * of 8. */
        if (sd->total_length == 0)
@@ -187,9 +184,6 @@ u8 *
 write_wim_security_data(const struct wim_security_data * restrict sd,
                        u8 * restrict p)
 {
-       DEBUG("Writing security data (total_length = %"PRIu32", num_entries "
-             "= %"PRIu32")", sd->total_length, sd->num_entries);
-
        u8 *orig_p = p;
        struct wim_security_data_disk *sd_disk = (struct wim_security_data_disk*)p;
        u32 num_entries = sd->num_entries;
@@ -209,8 +203,6 @@ write_wim_security_data(const struct wim_security_data * restrict sd,
                *p++ = 0;
 
        wimlib_assert(p - orig_p == sd->total_length);
-
-       DEBUG("Successfully wrote security data.");
        return p;
 }
 
@@ -354,7 +346,6 @@ sd_set_add_sd(struct wim_sd_set *sd_set, const char *descriptor, size_t size)
        sd->descriptors[sd->num_entries] = descr_copy;
        sd->sizes[sd->num_entries] = size;
        sd->num_entries++;
-       DEBUG("There are now %u security descriptors", sd->num_entries);
        bret = insert_sd_node(sd_set, new);
        wimlib_assert(bret);
        security_id = new->security_id;
index c15a31b0fa3b40d810fc9f576db05c318c3111c7..03eb122edb693e9192c124839b7483603962f1ce 100644 (file)
@@ -796,9 +796,6 @@ execute_add_command(struct update_command_journal *j,
        wim_target_path = add_cmd->add.wim_target_path;
        config_file = add_cmd->add.config_file;
 
-       DEBUG("fs_source_path=\"%"TS"\", wim_target_path=\"%"TS"\", add_flags=%#x",
-             fs_source_path, wim_target_path, add_flags);
-
        memset(&params, 0, sizeof(params));
 
 #ifdef WITH_NTFS_3G
@@ -892,8 +889,6 @@ execute_delete_command(struct update_command_journal *j,
        flags = delete_cmd->delete_.delete_flags;
        wim_path = delete_cmd->delete_.wim_path;
 
-       DEBUG("Deleting WIM path \"%"TS"\" (flags=%#x)", wim_path, flags);
-
        tree = get_dentry(wim, wim_path, WIMLIB_CASE_PLATFORM_DEFAULT);
        if (!tree) {
                /* Path to delete does not exist in the WIM. */
@@ -1064,22 +1059,6 @@ execute_rename_command(struct update_command_journal *j,
        return ret;
 }
 
-static inline const tchar *
-update_op_to_str(int op)
-{
-       switch (op) {
-       case WIMLIB_UPDATE_OP_ADD:
-               return T("add");
-       case WIMLIB_UPDATE_OP_DELETE:
-               return T("delete");
-       case WIMLIB_UPDATE_OP_RENAME:
-               return T("rename");
-       default:
-               wimlib_assert(0);
-               return NULL;
-       }
-}
-
 static bool
 have_command_type(const struct wimlib_update_command *cmds, size_t num_cmds,
                  enum wimlib_update_op op)
@@ -1138,8 +1117,6 @@ execute_update_commands(WIMStruct *wim,
        info.update.total_commands = num_cmds;
        ret = 0;
        for (size_t i = 0; i < num_cmds; i++) {
-               DEBUG("Executing update command %zu of %zu (op=%"TS")",
-                     i + 1, num_cmds, update_op_to_str(cmds[i].op));
                info.update.command = &cmds[i];
                if (update_flags & WIMLIB_UPDATE_FLAG_SEND_PROGRESS) {
                        ret = call_progress(wim->progfunc,
@@ -1424,15 +1401,11 @@ wimlib_update_image(WIMStruct *wim,
        if (update_flags & ~WIMLIB_UPDATE_FLAG_SEND_PROGRESS)
                return WIMLIB_ERR_INVALID_PARAM;
 
-       DEBUG("Updating image %d with %zu commands", image, num_cmds);
-
        /* Load the metadata for the image to modify (if not loaded already) */
        ret = select_wim_image(wim, image);
        if (ret)
                goto out;
 
-       DEBUG("Preparing %zu update commands", num_cmds);
-
        /* Make a copy of the update commands, in the process doing certain
         * canonicalizations on paths (e.g. translating backslashes to forward
         * slashes).  This is done to avoid modifying the caller's copy of the
@@ -1448,7 +1421,6 @@ wimlib_update_image(WIMStruct *wim,
                goto out_free_cmds_copy;
 
        /* Actually execute the update commands. */
-       DEBUG("Executing %zu update commands", num_cmds);
        ret = execute_update_commands(wim, cmds_copy, num_cmds, update_flags);
        if (ret)
                goto out_free_cmds_copy;
index f1180ccad1aa9d5adb79bfcec6815f730c30fd28..6450bb095c3f170997de80acfcfa3e66c4308e7d 100644 (file)
--- a/src/xml.c
+++ b/src/xml.c
@@ -1074,8 +1074,6 @@ xml_export_image(const struct wim_info *old_wim_info,
        struct image_info *image_info;
        int ret;
 
-       DEBUG("Copying XML data between WIM files for source image %d.", image);
-
        wimlib_assert(old_wim_info != NULL);
        wimlib_assert(image >= 1 && image <= old_wim_info->num_images);
 
@@ -1127,7 +1125,6 @@ xml_delete_image(struct wim_info **wim_info_p, int image)
 
        wim_info = *wim_info_p;
        wimlib_assert(image >= 1 && image <= wim_info->num_images);
-       DEBUG("Deleting image %d from the XML data.", image);
 
        destroy_image_info(&wim_info->images[image - 1]);
 
@@ -1500,7 +1497,6 @@ out_output_buffer_close:
 out_buffer_free:
        xmlBufferFree(buf);
 out:
-       DEBUG("ret=%d", ret);
        return ret;
 
 out_write_error:
@@ -1519,9 +1515,6 @@ write_wim_xml_data(WIMStruct *wim, int image, u64 total_bytes,
        u8 *xml_data;
        size_t xml_len;
 
-       DEBUG("Writing WIM XML data (image=%d, offset=%"PRIu64")",
-             image, wim->out_fd.offset);
-
        ret = prepare_wim_xml_data(wim, image, total_bytes,
                                   &xml_data, &xml_len);
        if (ret)
@@ -1539,7 +1532,6 @@ write_wim_xml_data(WIMStruct *wim, int image, u64 total_bytes,
                                             NULL,
                                             write_resource_flags);
        FREE(xml_data);
-       DEBUG("ret=%d", ret);
        return ret;
 }
 
@@ -1588,7 +1580,6 @@ wimlib_get_xml_data(WIMStruct *wim, void **buf_ret, size_t *bufsize_ret)
 
        xml_reshdr = &wim->hdr.xml_data_reshdr;
 
-       DEBUG("Reading XML data.");
        *bufsize_ret = xml_reshdr->uncompressed_size;
        return wim_reshdr_to_data(xml_reshdr, wim, buf_ret);
 }