commit-hurd
[Top][All Lists]
Advanced

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

[hurd] 25/64: boot: remove unused function `boot_script_read_file'


From: Samuel Thibault
Subject: [hurd] 25/64: boot: remove unused function `boot_script_read_file'
Date: Wed, 10 Dec 2014 15:17:05 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream
in repository hurd.

commit a99d8b562d74e3b08c88d52433914d9c1c6bd362
Author: Justus Winter <address@hidden>
Date:   Thu Nov 6 13:59:59 2014 +0100

    boot: remove unused function `boot_script_read_file'
    
    The unused function `boot_script_read_file' requires access to the
    default pager, which is privileged.
    
    * boot/boot.c (defpager): Remove now unused variable.
    (boot_script_read_file): Remove unused function.
    (main): Do not acquire port to the default pager.
    * boot/boot_script.h (boot_script_read_file): Remove declaration.
---
 boot/boot.c        | 46 +---------------------------------------------
 boot/boot_script.h |  4 ----
 2 files changed, 1 insertion(+), 49 deletions(-)

diff --git a/boot/boot.c b/boot/boot.c
index d5b8096..250018e 100644
--- a/boot/boot.c
+++ b/boot/boot.c
@@ -109,7 +109,7 @@ typedef struct stat host_stat_t;
 
 #endif /* UX */
 
-mach_port_t privileged_host_port, master_device_port, defpager;
+mach_port_t privileged_host_port, master_device_port;
 mach_port_t pseudo_master_device_port;
 mach_port_t receive_set;
 mach_port_t pseudo_console, pseudo_root;
@@ -281,47 +281,6 @@ void read_reply ();
 void * msg_thread (void *);
 
 /* Callbacks for boot_script.c; see boot_script.h.  */
-
-mach_port_t
-boot_script_read_file (const char *filename)
-{
-  static const char msg[] = ": cannot open\n";
-  int fd = useropen (filename, O_RDONLY, 0);
-  host_stat_t st;
-  error_t err;
-  mach_port_t memobj;
-  vm_address_t region;
-
-  write (2, filename, strlen (filename));
-  if (fd < 0)
-    {
-      write (2, msg, sizeof msg - 1);
-      host_exit (1);
-    }
-  else
-    write (2, msg + sizeof msg - 2, 1);
-
-  host_fstat (fd, &st);
-
-  err = default_pager_object_create (defpager, &memobj,
-                                    round_page (st.st_size));
-  if (err)
-    {
-      static const char msg[] = "cannot create default-pager object\n";
-      write (2, msg, sizeof msg - 1);
-      host_exit (1);
-    }
-
-  region = 0;
-  vm_map (mach_task_self (), &region, round_page (st.st_size),
-         0, 1, memobj, 0, 0, VM_PROT_ALL, VM_PROT_ALL, VM_INHERIT_NONE);
-  read (fd, (char *) region, st.st_size);
-  munmap ((caddr_t) region, round_page (st.st_size));
-
-  close (fd);
-  return memobj;
-}
-
 int
 boot_script_exec_cmd (void *hook,
                      mach_port_t task, char *path, int argc,
@@ -532,9 +491,6 @@ main (int argc, char **argv, char **envp)
 
   get_privileged_ports (&privileged_host_port, &master_device_port);
 
-  defpager = MACH_PORT_NULL;
-  vm_set_default_memory_manager (privileged_host_port, &defpager);
-
   strcat (bootstrap_args, "f");
 
   mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_PORT_SET,
diff --git a/boot/boot_script.h b/boot/boot_script.h
index 6245869..da52e6f 100644
--- a/boot/boot_script.h
+++ b/boot/boot_script.h
@@ -69,10 +69,6 @@ int boot_script_exec_cmd (void *hook,
                          task_t task, char *path, int argc,
                          char **argv, char *strings, int stringlen);
 
-/* The user must define this function.  Load the contents of FILE
-   into a fresh anonymous memory object and return the memory object port.  */
-mach_port_t boot_script_read_file (const char *file);
-
 /* The user must define this functions to perform the corresponding
    Mach task manipulations.  */
 int boot_script_task_create (struct cmd *); /* task_create + task_suspend */

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

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