bug-hurd
[Top][All Lists]
Advanced

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

Re: [PATCH hurd 5/9] boot: remove unused function `boot_script_read_file


From: Samuel Thibault
Subject: Re: [PATCH hurd 5/9] boot: remove unused function `boot_script_read_file'
Date: Fri, 21 Nov 2014 01:38:22 +0100
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Justus Winter, le Fri 07 Nov 2014 17:31:58 +0100, a écrit :
> The unused function `boot_script_read_file' requires access to the
> default pager, which is privileged.

Ack.

> * 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 */
> -- 
> 2.1.1
> 

-- 
Samuel
> X..., c'est un millefeuille avec une couche de crème patissière, une
> de sauce tomate et une de crème d'anchois... Mais c'est vrai que
> c'est un système ouvert: tu peux y rajouter des pépites de chocolat...
-+- Ol in Guide du linuxien pervers - "Remettez m'en une couche !" -+-



reply via email to

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