diff options
Diffstat (limited to 'libstore')
-rw-r--r-- | libstore/Makefile | 1 | ||||
-rw-r--r-- | libstore/gunzip.c | 1 | ||||
-rw-r--r-- | libstore/part.c | 11 | ||||
-rw-r--r-- | libstore/unzipstore.c | 8 |
4 files changed, 11 insertions, 10 deletions
diff --git a/libstore/Makefile b/libstore/Makefile index 9381b95c..eafdd0a7 100644 --- a/libstore/Makefile +++ b/libstore/Makefile @@ -53,6 +53,7 @@ libstore.so-LDLIBS += $(PARTED_LIBS) -ldl installhdrs=store.h HURDLIBS = shouldbeinlibc +LDLIBS += -lpthread GUNZIP_OBJS = unzip.o inflate.o util.o BUNZIP2_OBJS = do-bunzip2.o OBJS = $(SRCS:.c=.o) $(GUNZIP_OBJS) $(BUNZIP2_OBJS) diff --git a/libstore/gunzip.c b/libstore/gunzip.c index 3bff6ead..7c449403 100644 --- a/libstore/gunzip.c +++ b/libstore/gunzip.c @@ -21,7 +21,6 @@ #include <stdio.h> #include <string.h> #include <setjmp.h> -#include <cthreads.h> #include <sys/mman.h> #include "store.h" diff --git a/libstore/part.c b/libstore/part.c index 439340be..56e904eb 100644 --- a/libstore/part.c +++ b/libstore/part.c @@ -22,7 +22,7 @@ #include <stdlib.h> #include <errno.h> #include <assert.h> -#include <cthreads.h> +#include <pthread.h> #include <parted/parted.h> /*#include <parted/device_gnu.h>*/ @@ -40,8 +40,9 @@ error_t store_part_create (struct store *source, int index, int flags, struct store **store) { - static struct mutex parted_lock = MUTEX_INITIALIZER; + static pthread_mutex_t parted_lock = PTHREAD_MUTEX_INITIALIZER; static int version_check; + error_t err = 0; PedDevice *dev; PedDisk *disk; @@ -54,7 +55,7 @@ store_part_create (struct store *source, int index, int flags, && source->block_size % PED_SECTOR_SIZE != 0)) return EINVAL; - mutex_lock (&parted_lock); + pthread_mutex_lock (&parted_lock); /* Since Parted provides no source-level information about version compatibility, we have to check at run time. */ @@ -73,7 +74,7 @@ store_part_create (struct store *source, int index, int flags, if (version_check <= 0) { error (0, 0, "the `part' store type is not available"); - mutex_unlock (&parted_lock); + pthread_mutex_unlock (&parted_lock); return ENOTSUP; } @@ -149,7 +150,7 @@ out_with_dev: ped_device_destroy (dev); out: ped_exception_leave_all (); - mutex_unlock (&parted_lock); + pthread_mutex_unlock (&parted_lock); if (! err) err = store_remap (source, &run, 1, store); diff --git a/libstore/unzipstore.c b/libstore/unzipstore.c index 35e9e7af..8d500c1b 100644 --- a/libstore/unzipstore.c +++ b/libstore/unzipstore.c @@ -21,7 +21,7 @@ #include <stdio.h> #include <string.h> #include <setjmp.h> -#include <cthreads.h> +#include <pthread.h> #include <sys/mman.h> #include "store.h" @@ -29,7 +29,7 @@ #define IN_BUFFERING (256*1024) #define OUT_BUFFERING (512*1024) -static struct mutex unzip_lock = MUTEX_INITIALIZER; +static pthread_mutex_t unzip_lock = PTHREAD_MUTEX_INITIALIZER; #define STORE_UNZIP(name) STORE_UNZIP_1 (UNZIP, name) #define STORE_UNZIP_1(unzip,name) STORE_UNZIP_2 (unzip, name) @@ -182,7 +182,7 @@ unzip_store (struct store *from, void **buf, size_t *buf_len) if (zerr) return zerr; - mutex_lock (&unzip_lock); + pthread_mutex_lock (&unzip_lock); unzip_read = zread; unzip_write = zwrite; @@ -195,7 +195,7 @@ unzip_store (struct store *from, void **buf, size_t *buf_len) zerr = DO_UNZIP (); } - mutex_unlock (&unzip_lock); + pthread_mutex_unlock (&unzip_lock); if (in_buf_size > 0) munmap (in_buf, in_buf_size); |