Hi all,

currently at least 2 pagers are distributed with the Hurd: "mach-defpager", which it's the default pager and "defpager". Although the last it's not finished (see TODO) and it's not used it's also in the Hurd repo.
I'm not sure if it's in a state where can be used.

I propose to move defpager from the hurd repo to the incubator repo so it's less code on the Hurd repo to maintain. defpager would still be available for development on the incubator repo if there's motivation.

--
Melhores cumprimentos/Best regards,

Miguel Figueiredo
diff --git a/Makefile b/Makefile
index 4a87461..58609f3 100644
--- a/Makefile
+++ b/Makefile
@@ -33,7 +33,7 @@ lib-subdirs = libshouldbeinlibc libihash libiohelp libports libthreads \
 # Hurd programs
 prog-subdirs = auth proc exec init term \
 	       ufs ext2fs isofs tmpfs fatfs \
-	       storeio pflocal pfinet defpager mach-defpager \
+	       storeio pflocal pfinet mach-defpager \
 	       login daemons boot console \
 	       hostmux usermux ftpfs trans \
 	       console-client utils sutils ufs-fsck ufs-utils \
diff --git a/defpager/Makefile b/defpager/Makefile
deleted file mode 100644
index 8f92dd7..0000000
--- a/defpager/Makefile
+++ /dev/null
@@ -1,34 +0,0 @@
-# 
-#   Copyright (C) 1995, 1996 Free Software Foundation
-#   Written by Michael I. Bushnell.
-#
-#   This file is part of the GNU Hurd.
-#
-#   The GNU Hurd is free software; you can redistribute it and/or
-#   modify it under the terms of the GNU General Public License as
-#   published by the Free Software Foundation; either version 2, or (at
-#   your option) any later version.
-#
-#   The GNU Hurd is distributed in the hope that it will be useful, but
-#   WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#   General Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License
-#   along with this program; if not, write to the Free Software
-#   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-dir := defpager
-makemode := misc
-
-SRCS = defpager.c
-
-subst-functions=__syscall_vm_allocate syscall_vm_allocate \
-		__vm_allocate_rpc vm_allocate_rpc \
-		__syscall_vm_map syscall_vm_map \
-		__vm_map_rpc vm_map_rpc
-comma=,
-LDFLAGS=-Wl,$(subst :,$(comma),$(strip $(subst-functions)))
-
-include ../Makeconf
-
diff --git a/defpager/backing.c b/defpager/backing.c
deleted file mode 100644
index 24aab6d..0000000
--- a/defpager/backing.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/* Backing store management for GNU Hurd.
-   Copyright (C) 1996 Free Software Foundation, Inc.
-   Written by Thomas Bushnell, n/BSG.
-
-   This file is part of the GNU Hurd.
-
-   The GNU Hurd is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2, or (at
-   your option) any later version.
-
-   The GNU Hurd is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-
-#include <hurd/store.h>
-
-const struct store_class *const permitted_classes[] = 
-{
-  &store_device_class, &store_ileave_class, &store_concat_class, 0
-};
-
-/* Allocation map, by PAGE.  */  
-/* If a bit is SET the corresponding PAGE is free. */
-char *bmap;
-
-/* Number of bytes in bmap */
-size_t bmap_len;
-
-/* Allocation rotor */
-char *bmap_rotor;
-
-pthread_mutex_t bmap_lock = PTHREAD_MUTEX_INITIALIZER;
-
-error_t
-init_backing (char *name)
-{
-  error_t err;
-  int i;
-
-  err = store_open (name, STORE_NO_FILEIO, &permitted_classes, &backing_store);
-  if (err)
-    return err;
-  
-  bmap_len = backing_store->size / vm_page_size / NBBY;
-  bmap = malloc (bmap_len);
-  for (i = 0; i < bmap_len; i++)
-    bmap[i] = 0xff;
-  bmap_rotor = bmap;
-
-  /* Mark the very first page as occupied.  This makes sure we never
-     return zero offsets from allocate_backing_page (which
-     conventionally means that there is no space left.  It also makes
-     sure we don't tromp on the misfeature in Linux of using the first
-     page for permanent data. */
-  *bmap_rotor |= 1;
-}
-
-int
-allocate_backing_page ()
-{
-  int wrapped;
-  int bit;
-  int pfn;
-
-  pthread_mutex_lock (&bmap_lock);
-
-  wrapped = (bmap_rotor == bmap);
-
-  while (!wrapped || bmap_rotor < bmap + bmap_len)
-    {
-      if (bmap[bmap_rotor])
-	break;
-      bmap_rotor++;
-      if (bmap_rotor >= bmap + bmap_len)
-	wrapped++;
-    }
-  
-  if (wrapped == 2)
-    {
-      /* Didn't find one... */
-      pthread_mutex_unlock (&bmap_lock);
-      printf ("WARNING: Out of paging space; pageout failing.");
-      return 0;
-    }
-  
-  /* Find which bit */
-  bit = ffs (*bmap_rotor);
-  assert (bit);
-  bit--;
-  
-  /* Mark it */
-  *bmap_rotor |= 1 << bit;
-  
-  /* Return the correct offset */
-  pfn = (bmap_rotor - bmap) * 8 + bit;
-
-  pthread_mutex_unlock (&bmap_lock);
-  
-  return pfn * (vm_page_size / store->block_size);
-}
-
-
-void
-return_backing_pages (off_t *map, int maplen)
-{
-  int i;
-  
-  pthread_mutex_lock (&bmap_lock);
-  for (i = 0; i < maplen; i++)
-    {
-      int pfn;
-      char *b;
-      int bit;
-
-      pfn = map[i] / (vm_page_size / store->block_size);
-      b = bmap + pfn & ~7;
-      bit = pfn & 7;
-      
-      assert ((*b & (1 << bit)) == 0);
-      *b |= 1 << bit;
-    }
-  pthread_mutex_unlock (&bmap_lock);
-}
-
diff --git a/defpager/defpager.c b/defpager/defpager.c
deleted file mode 100644
index 3a824cf..0000000
--- a/defpager/defpager.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Default pager for GNU Hurd.
-   Copyright (C) 1996 Free Software Foundation, Inc.
-   Written by Thomas Bushnell, n/BSG.
-
-   This file is part of the GNU Hurd.
-
-   The GNU Hurd is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2, or (at
-   your option) any later version.
-
-   The GNU Hurd is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-
-#include <hurd/pager.h>
-#include <hurd/store.h>
-
-struct user_pager_info 
-{
-  /* Size of the object */
-  vm_size_t size;
-
-  /* One entry for each page of the object. */
-  off_t *map;
-};
-
-/* Expand the P->map as necessary to handle an incoming request of the
-   page at ADDR. */
-static inline void
-expand_map (struct user_pager_info *p, vm_offset_t addr)
-{
-  /* See if this is beyond the current extent */
-  if (page >= pager->size)
-    {
-      off_t *newmap;
-      vm_size_t newsize;
-
-      newsize = page + vm_page_size;
-      newmap = realloc (pager->map, size / vm_page_size * sizeof (off_t));
-
-      bzero (pager->map + pager->size / vm_page_size * sizeof (off_t),
-	     (newsize - pager->size) / vm_page_size * sizeof (off_t));
-      pager->size = newsize;
-      pager->map = newmap;
-    }
-}
-
-error_t
-pager_read_page (struct user_pager_info *pager,
-		 vm_offset_t page,
-		 vm_address_t *buf,
-		 int *write_lock)
-{
-  int pfn = page / vm_page_size;
-  size_t nread;
-  
-  /* We never request write locks. */
-  *write_lock = 0;
-
-  expand_map (pager, page);
-
-  if (!pager->map[pfn])
-    vm_allocate (mach_task_self (), buf, vm_page_size, 1);
-  else
-    {
-      store_read (backing_store, pager->map[pfn], vm_page_size, 
-		  (void **)buf, &nread);
-      if (nread != vm_page_size)
-	{
-	  munmap ((caddr_t) *buf, nread);
-	  return EIO;
-	}
-    }
-  return 0;
-}
-
-      
-error_t
-pager_write_page (struct user_pager_info *pager,
-		  vm_offset_t page,
-		  vm_address_t buf)
-{
-  int pfn = page / vm_page_size;
-  size_t nwritten;
-  
-  expand_map (pager, page);
-  
-  if (!pager->map[pfn])
-    pager->map[pfn] = allocate_backing_page ();
-  
-  /* No more backing store.  Oh dear. */
-  if (!pager->map[pfn])
-    return EIO;
-  
-  err = store_write (backing_store, pager->map[pfn], (void *) buf, 
-		     vm_page_size, &nwritten);
-  if (!err && nwritten != vm_page_size)
-    err = EIO;
-  return err;
-}
-
-error_t
-pager_unlock_page (struct user_pager_info *pager,
-		   vm_offset_t address)
-{
-  return 0;
-}
-
-error_t
-pager_report_extent (struct user_pager_info *pager,
-		     vm_address_t *offset,
-		     vm_size_t *size)
-{
-  *offset = 0;
-  *size = pager->size;
-  return 0;
-}
-
-void
-pager_clear_user_data (struct user_pager_info *pager)
-{
-  return_backing_pages (pager->map, pager->size / vm_page_size);
-  free (pager->map);
-}
-
-void
-pager_dropweak (struct user_pager_info *pager)
-{
-}
diff --git a/defpager/wiring.c b/defpager/wiring.c
deleted file mode 100644
index dda5d9d..0000000
--- a/defpager/wiring.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* Memory wiring functions for default pager
-   Copyright (C) 1996 Free Software Foundation, Inc.
-   Written by Thomas Bushnell, n/BSG.
-
-   This file is part of the GNU Hurd.
-
-   The GNU Hurd is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2, or (at
-   your option) any later version.
-
-   The GNU Hurd is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-
-/* This file uses the "wrap" feature of GNU ld.  See the GNU ld
-   documentation for more information on how this works.  
-   The list of functions we wrap is specified in Makefile as
-   $(subst-functions). */
-
-
-error_t
-__wrap___syscall_vm_allocate (task_t target_task,
-			      vm_address_t *address,
-			      vm_size_t size,
-			      boolean_t anywhere)
-{
-  error_t err;
-  
-  err = __real___syscall_vm_allocate (target_task, address, size, anywhere);
-  if (!err && target_task == mach_task_self ())
-    wire_segment (*address, size);
-  return err;
-}
-
-error_t
-__wrap___vm_allocate_rpc (task_t target_task,
-			  vm_address_t *address,
-			  vm_size_t size,
-			  boolean_t anywhere)
-{
-  error_t err;
-  
-  err = __real___vm_allocate_rpc (target_task, address, size, anywhere);
-  if (!err && target_task == mach_task_self ())
-    wire_segment (*address, size);
-  return err;
-}
-
-error_t 
-__wrap___syscall_vm_map (mach_port_t target_task,
-			 vm_address_t *address,
-			 vm_size_t size,
-			 vm_address_t mask,
-			 boolean_t anywhere,
-			 mach_port_t memory_object,
-			 vm_offset_t offset,
-			 boolean_t copy,
-			 vm_prot_t cur_protection,
-			 vm_prot_t max_protection,
-			 vm_inherit_t inheritance)
-{
-  error_t err;
-  
-  err = __real___syscall_vm_map (target_task, address, size, mask, anywhere,
-				 memory_object, offset, copy, cur_protection,
-				 max_protection, inheritance);
-  if (!err && target_task == mach_task_self ())
-    wire_segment (*address, size);
-  return err;
-}
-
-
-error_t 
-__wrap___vm_map_rpc (mach_port_t target_task,
-		     vm_address_t *address,
-		     vm_size_t size,
-		     vm_address_t mask,
-		     boolean_t anywhere,
-		     mach_port_t memory_object,
-		     vm_offset_t offset,
-		     boolean_t copy,
-		     vm_prot_t cur_protection,
-		     vm_prot_t max_protection,
-		     vm_inherit_t inheritance)
-{
-  error_t err;
-  
-  err = __real___vm_map_rpc (target_task, address, size, mask, anywhere,
-			     memory_object, offset, copy, cur_protection,
-			     mak_protection, inheritance);
-  if (!err && target_task == mach_task_self ())
-    wire_segment (*address, size);
-  return err;
-}
-
-/* And the non-__ versions too. */
-
-#define weak_alias(name,aliasname) \
-  extern typeof (name) aliasname __attribute__ ((weak, alias (#name)));
-
-weak_alias (__wrap___vm_map_rpc, __wrap_vm_map_rpc)
-weak_alias (__wrap___syscall_vm_map, __wrap_syscall_vm_map)
-weak_alias (__wrap___vm_allocate_rpc, __wrap_vm_allocate_rpc)
-weak_alias (__wrap___syscall_vm_allocate, __wrap_syscall_vm_allocate)

Reply via email to