ia64/xen-unstable

changeset 595:884c96cebace

bitkeeper revision 1.329.1.4 (3f0d4373d9SiOpCi9y2d8jsIGk2rgw)

More silly little cleanups.
author sos22@labyrinth.cl.cam.ac.uk
date Thu Jul 10 10:44:03 2003 +0000 (2003-07-10)
parents e421961ce0bc
children 681598b3259f
files tools/internal/xi_build.c
line diff
     1.1 --- a/tools/internal/xi_build.c	Thu Jul 10 10:33:47 2003 +0000
     1.2 +++ b/tools/internal/xi_build.c	Thu Jul 10 10:44:03 2003 +0000
     1.3 @@ -24,6 +24,10 @@
     1.4  #define GUEST_SIG   "XenoGues"
     1.5  #define SIG_LEN    8
     1.6  
     1.7 +/* Watch for precedence when using thses ones... */
     1.8 +#define PROC_XENO_DOM0_CMD "/proc/" PROC_XENO_ROOT "/" PROC_CMD
     1.9 +#define PROC_XENO_DOMAINS "/proc" PROC_XENO_ROOT "/" PROC_DOMAINS
    1.10 +
    1.11  /*
    1.12   * NB. No ring-3 access in initial guestOS pagetables. Note that we allow
    1.13   * ring-3 privileges in the page directories, so that the guestOS may later
    1.14 @@ -153,7 +157,6 @@ static dom_meminfo_t *setup_guestos(int 
    1.15      unsigned long num_pgt_updates = 0;
    1.16      unsigned long count, pt_start;
    1.17      struct dom0_dopgupdates_args pgupdate_req;
    1.18 -    char cmd_path[MAX_PATH];
    1.19      int cmd_fd;
    1.20      int result;
    1.21  
    1.22 @@ -259,10 +262,9 @@ static dom_meminfo_t *setup_guestos(int 
    1.23       * Send the page update requests down to the hypervisor.
    1.24       * NB. We must do this before loading the guest OS image!
    1.25       */
    1.26 -    sprintf(cmd_path, "%s%s%s%s", "/proc/", PROC_XENO_ROOT, "/", PROC_CMD);
    1.27 -    if ( (cmd_fd = open(cmd_path, O_WRONLY)) < 0 )
    1.28 +    if ( (cmd_fd = open(PROC_XENO_DOM0_CMD, O_WRONLY)) < 0 )
    1.29      {
    1.30 -	dberr ("Could not open /proc/" PROC_XENO_ROOT "/" PROC_CMD ".");
    1.31 +	dberr ("Could not open " PROC_XENO_DOM0_CMD);
    1.32  	goto error_out;
    1.33      }
    1.34  
    1.35 @@ -320,12 +322,10 @@ static dom_meminfo_t *setup_guestos(int 
    1.36  
    1.37  static int launch_domain(dom_meminfo_t  * meminfo)
    1.38  {
    1.39 -    char cmd_path[MAX_PATH];
    1.40      dom0_op_t dop;
    1.41      int cmd_fd;
    1.42  
    1.43 -    sprintf(cmd_path, "%s%s%s%s", "/proc/", PROC_XENO_ROOT, "/", PROC_CMD);
    1.44 -    cmd_fd = open(cmd_path, O_WRONLY);
    1.45 +    cmd_fd = open(PROC_XENO_DOM0_CMD, O_WRONLY);
    1.46      if(cmd_fd < 0){
    1.47          perror(PERR_STRING);
    1.48          return -1;
    1.49 @@ -344,14 +344,10 @@ static int get_domain_info (int domain_i
    1.50                              int *tot_pages)
    1.51  {
    1.52      FILE *f; 
    1.53 -    char domains_path[MAX_PATH];
    1.54      char domains_line[256];
    1.55      int read_id;
    1.56  
    1.57 -    sprintf (domains_path, "%s%s%s%s", "/proc/", PROC_XENO_ROOT, "/",
    1.58 -	     PROC_DOMAINS);
    1.59 -
    1.60 -    f = fopen (domains_path, "r");
    1.61 +    f = fopen (PROC_XENO_DOMAINS, "r");
    1.62      if (f == NULL) return -1;
    1.63  
    1.64      read_id = -1;
    1.65 @@ -362,7 +358,7 @@ static int get_domain_info (int domain_i
    1.66          trans = sscanf (domains_line, "%d %*d %*d %*d %*d %*d %x %d %*s", &read_id
    1.67                          , pg_head, tot_pages);
    1.68  	if (trans != 3) {
    1.69 -	    dberr ("format of /proc/" PROC_XENO_ROOT "/" PROC_DOMAINS " changed -- wrong kernel version?");
    1.70 +	    dberr ("format of " PROC_XENO_DOMAINS " changed -- wrong kernel version?");
    1.71  	    read_id = -1;
    1.72  	    break;
    1.73  	}