return p;
}
+#ifdef WITH_FUSE
static FILE *wim_get_fp(WIMStruct *w)
{
pthread_mutex_lock(&w->fp_tab_mutex);
pthread_mutex_unlock(&w->fp_tab_mutex);
return ret;
}
+#endif
/*
* Reads some data from the resource corresponding to a WIM lookup table entry.
* or uncompressed. */
wimlib_assert(lte->wim != NULL);
+ #ifdef WITH_FUSE
if (flags & WIMLIB_RESOURCE_FLAG_MULTITHREADED) {
fp = wim_get_fp(lte->wim);
if (!fp)
return WIMLIB_ERR_OPEN;
- } else {
+ } else
+ #endif
+ {
+ wimlib_assert(!(flags & WIMLIB_RESOURCE_FLAG_MULTITHREADED));
wimlib_assert(lte->wim->fp != NULL);
fp = lte->wim->fp;
}
lte->resource_entry.original_size,
lte->resource_entry.offset,
ctype, size, offset, buf);
+ #ifdef WITH_FUSE
if (flags & WIMLIB_RESOURCE_FLAG_MULTITHREADED) {
int ret2 = wim_release_fp(lte->wim, fp);
if (ret == 0)
ret = ret2;
}
+ #endif
break;
case RESOURCE_IN_STAGING_FILE:
case RESOURCE_IN_FILE_ON_DISK:
WIMStruct *new_wim_struct()
{
WIMStruct *w = CALLOC(1, sizeof(WIMStruct));
+#ifdef WITH_FUSE
if (pthread_mutex_init(&w->fp_tab_mutex, NULL) != 0) {
ERROR_WITH_ERRNO("Failed to initialize mutex");
FREE(w);
w = NULL;
}
+#endif
return w;
}
if (w->out_fp)
fclose(w->out_fp);
+#ifdef WITH_FUSE
if (w->fp_tab) {
for (size_t i = 0; i < w->num_allocated_fps; i++)
if (w->fp_tab[i])
FREE(w->fp_tab);
}
pthread_mutex_destroy(&w->fp_tab_mutex);
+#endif
free_lookup_table(w->lookup_table);
#ifndef _WIMLIB_INTERNAL_H
#define _WIMLIB_INTERNAL_H
+#include "config.h"
#include "util.h"
#include "list.h"
+#ifdef WITH_FUSE
#include <pthread.h>
+#endif
struct stat;
struct dentry;
/* A pointer to the file indicated by @filename, opened for reading. */
FILE *fp;
+#ifdef WITH_FUSE
FILE **fp_tab;
size_t num_allocated_fps;
pthread_mutex_t fp_tab_mutex;
+#endif
/* FILE pointer for the WIM file that is being written. */
FILE *out_fp;