hurdextras-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

memfs ChangeLog Makefile README debug.c memfs.c


From: Samuel Thibault
Subject: memfs ChangeLog Makefile README debug.c memfs.c
Date: Sun, 10 Feb 2013 10:34:01 +0000

CVSROOT:        /cvsroot/hurdextras
Module name:    memfs
Changes by:     Samuel Thibault <sthibaul>      13/02/10 10:34:01

Modified files:
        .              : ChangeLog Makefile README debug.c memfs.c 

Log message:
        2013-02-10  Samuel Thibault  <address@hidden>
        
                Fix build against libpthread.
        
                * Makefile: Link against libpthread instead of libthreads.
                * README: Advise to lib against libbpthread instead of advising 
to
                link against libthreads.
                * debug.c: Include pthread.h instead of cthreads.h and 
rwlock.h. Use
                pthread_mutex instead of Mach mutex.
                * membfs: Likewise, use pthread_rwlock_t instead of Mach rwlock.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/memfs/ChangeLog?cvsroot=hurdextras&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/memfs/Makefile?cvsroot=hurdextras&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/memfs/README?cvsroot=hurdextras&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/memfs/debug.c?cvsroot=hurdextras&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/memfs/memfs.c?cvsroot=hurdextras&r1=1.1&r2=1.2

Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/hurdextras/memfs/ChangeLog,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- ChangeLog   12 Apr 2006 21:43:03 -0000      1.1
+++ ChangeLog   10 Feb 2013 10:34:00 -0000      1.2
@@ -1,3 +1,13 @@
+2013-02-10  Samuel Thibault  <address@hidden>
+
+       Fix build against libpthread.
+
+       * Makefile: Link against libpthread instead of libthreads.
+       * README: Advise to lib against libbpthread instead of advising to
+       link against libthreads.
+       * debug.c: Include pthread.h instead of cthreads.h and rwlock.h. Use
+       pthread_mutex instead of Mach mutex.
+       * membfs: Likewise, use pthread_rwlock_t instead of Mach rwlock.
 
 2006-04-12  Manuel Menal  <address@hidden>
 

Index: Makefile
===================================================================
RCS file: /cvsroot/hurdextras/memfs/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- Makefile    12 Apr 2006 21:43:03 -0000      1.1
+++ Makefile    10 Feb 2013 10:34:00 -0000      1.2
@@ -1,6 +1,6 @@
 # Makefile for memory based Hurd filesystems
 # Copyright (C) 2000 Farid Hajji <address@hidden>
-# $Id: Makefile,v 1.1 2006/04/12 21:43:03 mmenal Exp $
+# $Id: Makefile,v 1.2 2013/02/10 10:34:00 sthibaul Exp $
 
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License as
@@ -17,6 +17,18 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 # $Log: Makefile,v $
+# Revision 1.2  2013/02/10 10:34:00  sthibaul
+# 2013-02-10  Samuel Thibault  <address@hidden>
+#
+#      Fix build against libpthread.
+#
+#      * Makefile: Link against libpthread instead of libthreads.
+#      * README: Advise to lib against libbpthread instead of advising to
+#      link against libthreads.
+#      * debug.c: Include pthread.h instead of cthreads.h and rwlock.h. Use
+#      pthread_mutex instead of Mach mutex.
+#      * membfs: Likewise, use pthread_rwlock_t instead of Mach rwlock.
+#
 # Revision 1.1  2006/04/12 21:43:03  mmenal
 # Initial commit of a memfs written by Farid Hajji (Manuel)
 #
@@ -27,8 +39,8 @@
 CC      = gcc
 CFLAGS  = -D_GNU_SOURCE -Wall -g -D_FILE_OFFSET_BITS=64
 #CFLAGS  = -Wall -O2
-LDFLAGS = -lthreads -lports -ltrivfs -lfshelp
-#HURDLIBS = -lthreads -lports -ltrivfs -lfshelp -lpipe -lihash -lshouldbeinlibc
+LDFLAGS = -lpthread -lports -ltrivfs -lfshelp
+#HURDLIBS = -lpthread -lports -ltrivfs -lfshelp -lpipe -lihash -lshouldbeinlibc
 SRC     = memfs.c debug.c
 OBJ     = $(SRC:%.c=%.o)
 TRANS   = memfs

Index: README
===================================================================
RCS file: /cvsroot/hurdextras/memfs/README,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- README      12 Apr 2006 21:43:03 -0000      1.1
+++ README      10 Feb 2013 10:34:00 -0000      1.2
@@ -1,4 +1,4 @@
-$Id: README,v 1.1 2006/04/12 21:43:03 mmenal Exp $
+$Id: README,v 1.2 2013/02/10 10:34:00 sthibaul Exp $
 
           Memory based filesystem translators for the Hurd
        Copyright (C) 2000 Farid Hajji <address@hidden>
@@ -78,7 +78,7 @@
 $ cd mem-fs
 $ make
 cc -Wall -g -c memfs-1.c -o memfs-1.o
-cc -Wall -g -o memfs-1 memfs-1.o -lthreads -lports -ltrivfs -lfshelp
+cc -Wall -g -o memfs-1 memfs-1.o -lpthread -lports -ltrivfs -lfshelp
 cc -Wall -g -c test-memfs-1.c -o test-memfs-1.o
 cc -Wall -g -o test-memfs-1 test-memfs-1.o
 

Index: debug.c
===================================================================
RCS file: /cvsroot/hurdextras/memfs/debug.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- debug.c     12 Apr 2006 21:43:03 -0000      1.1
+++ debug.c     10 Feb 2013 10:34:00 -0000      1.2
@@ -4,8 +4,7 @@
 #include <fcntl.h>
 #include <time.h>
 #include <sys/mman.h>
-#include <cthreads.h>
-#include <rwlock.h>
+#include <pthread.h>
 #include <sys/types.h>
 #include <stdarg.h>
 
@@ -50,7 +49,7 @@
 void
 debuglog (int dlevel, const char *msg, ...)
 {
-  struct mutex lock;
+  pthread_mutex_t lock;
 
   if (debuglevel >= dlevel)
     {
@@ -58,8 +57,8 @@
       struct tm *now_tm = localtime(&now);
       va_list ap;
 
-      mutex_init (&lock);
-      mutex_lock (&lock);
+      pthread_mutex_init (&lock, NULL);
+      pthread_mutex_lock (&lock);
 
       va_start(ap, msg);
 
@@ -73,7 +72,7 @@
 
       va_end(ap);
 
-      mutex_unlock (&lock);
-      mutex_clear (&lock);
+      pthread_mutex_unlock (&lock);
+      pthread_mutex_destroy (&lock);
     }
 }

Index: memfs.c
===================================================================
RCS file: /cvsroot/hurdextras/memfs/memfs.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- memfs.c     12 Apr 2006 21:43:03 -0000      1.1
+++ memfs.c     10 Feb 2013 10:34:00 -0000      1.2
@@ -57,12 +57,12 @@
 #include <string.h>
 #include <fcntl.h>
 #include <sys/mman.h>
-#include <cthreads.h>
-#include <rwlock.h>
+#include <pthread.h>
 #include <sys/types.h>
 #include <stdlib.h>
 #include <time.h>
 #include <stdarg.h>
+#include <assert.h>
 #include "debug.h"
 
 /* The max number of bytes that we will reserve via mmap().
@@ -78,7 +78,7 @@
 static size_t contents_len = 0;
 
 /* This lock protects access to CONTENTS and CONTENTS_LEN.  */
-static struct rwlock contents_lock;
+static pthread_rwlock_t contents_lock;
 
 /* Trivfs hooks. */
 int trivfs_fstype = FSTYPE_MISC;
@@ -111,7 +111,7 @@
 /* A hook for us to keep track of the file descriptor state. */
 struct open
 {
-  struct mutex lock;
+  pthread_mutex_t lock;
   off_t offs;
 };
 
@@ -165,7 +165,7 @@
   else
     op->offs = 0;
 
-  mutex_init (&op->lock);
+  pthread_mutex_init (&op->lock, NULL);
   peropen->hook = op;
   return 0;
 }
@@ -180,7 +180,7 @@
 
   op = peropen->hook;
 
-  mutex_clear (&op->lock);
+  pthread_mutex_destroy (&op->lock);
   free (op);
 }
 
@@ -229,13 +229,13 @@
 
   op = cred->po->hook;
 
-  mutex_lock (&op->lock);
+  pthread_mutex_lock (&op->lock);
 
   /* Get the offset. */
   if (offs == -1)
     offs = op->offs;
 
-  rwlock_reader_lock (&contents_lock);
+  pthread_rwlock_rdlock (&contents_lock);
 
   /* Prune the amount they want to read. */
   if (offs > contents_len)
@@ -260,9 +260,9 @@
       op->offs += amount;
     }
 
-  mutex_unlock (&op->lock);
+  pthread_mutex_unlock (&op->lock);
 
-  rwlock_reader_unlock (&contents_lock);
+  pthread_rwlock_unlock (&contents_lock);
 
   *data_len = amount;
 
@@ -297,13 +297,13 @@
 
   op = cred->po->hook;
 
-  mutex_lock (&op->lock);
+  pthread_mutex_lock (&op->lock);
 
   /* Get the offset. */
   if (offs == -1)
     offs = op->offs;
 
-  rwlock_reader_lock (&contents_lock);
+  pthread_rwlock_rdlock (&contents_lock);
 
   /* Are we going to go beyond MAXSIZE? */
   if (offs + data_len <= MAXSIZE)
@@ -333,14 +333,14 @@
     op->offs += *amount;
     debuglog (DEBUG_TRACE, "%s: %i bytes written.", __FUNCTION__, *amount);
 
-    mutex_unlock (&op->lock);
-    rwlock_reader_unlock (&contents_lock);
+    pthread_mutex_unlock (&op->lock);
+    pthread_rwlock_unlock (&contents_lock);
   }
   else
   {
     *amount = 0;
-    mutex_unlock (&op->lock);
-    rwlock_reader_unlock (&contents_lock);
+    pthread_mutex_unlock (&op->lock);
+    pthread_rwlock_unlock (&contents_lock);
     return ENOSPC;
   }
 
@@ -368,7 +368,7 @@
 
   op = cred->po->hook;
 
-  mutex_lock (&op->lock);
+  pthread_mutex_lock (&op->lock);
 
   switch (whence)
     {
@@ -389,7 +389,7 @@
   if (! err)
     *new_offs = op->offs;
 
-  mutex_unlock (&op->lock);
+  pthread_mutex_unlock (&op->lock);
 
   return err;
 }
@@ -435,7 +435,7 @@
        size = (size < 0) ? 0 : size;
        size = (size >= MAXSIZE) ? MAXSIZE : size;
 
-       rwlock_writer_lock (&contents_lock);
+       pthread_rwlock_wrlock (&contents_lock);
 
 //     contents = (char *) mmap (0, size,
 //                               PROT_READ | PROT_WRITE,
@@ -451,7 +451,7 @@
        contents_len = size;
        bzero (contents, contents_len);
 
-       rwlock_writer_unlock (&contents_lock);
+       pthread_rwlock_unlock (&contents_lock);
        break;
       }
     case 'd':
@@ -480,9 +480,9 @@
 
   debuglog (DEBUG_TRACE, __FUNCTION__);
 
-  rwlock_reader_lock (&contents_lock);
+  pthread_rwlock_rdlock (&contents_lock);
   err = asprintf (&opt, "--size=%ud", contents_len) < 0 ? ENOMEM : 0;
-  rwlock_reader_unlock (&contents_lock);
+  pthread_rwlock_unlock (&contents_lock);
 
   if (!err)
     {
@@ -520,7 +520,7 @@
   /* Initialize the lock that will protect CONTENTS and CONTENTS_LEN.
      We must do this before argp_parse, because parse_opt (above) will
      use the lock.  */
-  rwlock_init (&contents_lock);
+  pthread_rwlock_init (&contents_lock, NULL);
 
   /* We use the same argp for options available at startup
      as for options we'll accept in an fsys_set_options RPC.  */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]