Permalink
Browse files

- threads bug removed

  • Loading branch information...
tpoder1 committed Jul 5, 2015
1 parent 9218705 commit 297c7fcfb38620a50ebcc6db9e2b7760b9892f02
Showing with 48 additions and 1 deletion.
  1. +30 −0 nfdump-thread.patch
  2. +18 −1 src/libnf.c
View
@@ -159,3 +159,33 @@
*out_block_header = *(block_header);
in = (unsigned char __LZO_MMODEL *)((pointer_addr_t)block_header + sizeof(data_block_header_t));
--- nfdump-1.6.13/bin/nfx.c 2014-11-11 21:34:27.000000000 +0100
+++ nfdump/bin/nfx.c 2015-07-05 22:05:13.437449516 +0200
@@ -137,7 +137,7 @@
{ 0, 0, 0, 0, NULL }
};
-uint32_t Max_num_extensions;
+uint32_t Max_num_extensions = 0;
void FixExtensionMap(extension_map_t *map);
@@ -154,10 +154,14 @@
list->last_map = &list->map_list;
}
- Max_num_extensions = 0;
- i = 1;
- while ( extension_descriptor[i++].id ) {
- Max_num_extensions++;
+ /* modifie by libnf patch */
+ /* Max_num_extensions can be set onluy once */
+// Max_num_extensions = 0;
+ if (Max_num_extensions == 0) {
+ i = 1;
+ while ( extension_descriptor[i++].id ) {
+ Max_num_extensions++;
+ }
}
#ifdef DEVEL
i = 1;
View
@@ -262,10 +262,22 @@ int lnf_open(lnf_file_t **lnf_filep, const char * filename, unsigned int flags,
lnf_file->flags = flags;
/* open file in either read only or write only mode */
if (flags & LNF_WRITE) {
#ifdef LNF_THREADS
pthread_mutex_lock(&lnf_nfdump_filter_mutex);
#endif
lnf_file->nffile = OpenNewFile((char *)filename, NULL, flags & LNF_COMP,
flags & LNF_ANON, (char *)ident);
#ifdef LNF_THREADS
pthread_mutex_unlock(&lnf_nfdump_filter_mutex);
#endif
} else {
#ifdef LNF_THREADS
pthread_mutex_lock(&lnf_nfdump_filter_mutex);
#endif
lnf_file->nffile = OpenFile((char *)filename, NULL);
#ifdef LNF_THREADS
pthread_mutex_unlock(&lnf_nfdump_filter_mutex);
#endif
}
if (lnf_file->nffile == NULL) {
@@ -277,16 +289,21 @@ int lnf_open(lnf_file_t **lnf_filep, const char * filename, unsigned int flags,
lnf_file->processed_blocks = 0;
lnf_file->processed_bytes = 0;
lnf_file->skipped_blocks = 0;
#ifdef LNF_THREADS
pthread_mutex_lock(&lnf_nfdump_filter_mutex);
#endif
lnf_file->extension_map_list = InitExtensionMaps(NEEDS_EXTENSION_LIST);
lnf_file->lnf_map_list = NULL;
i = 1;
lnf_file->max_num_extensions = 0;
while ( extension_descriptor[i++].id )
lnf_file->max_num_extensions++;
#ifdef LNF_THREADS
pthread_mutex_unlock(&lnf_nfdump_filter_mutex);
#endif
*lnf_filep = lnf_file;

0 comments on commit 297c7fc

Please sign in to comment.