ia64/xen-unstable

changeset 553:2a6cc141dd5c

bitkeeper revision 1.308 (3f0ae161layZNlO8Hy90LYzFcZ9fkQ)

Final bit of merge.
author sos22@labyrinth.cl.cam.ac.uk
date Tue Jul 08 15:21:05 2003 +0000 (2003-07-08)
parents e923951ada95
children 83633bb4e30d
files xenolinux-2.4.21-sparse/arch/xeno/drivers/dom0/dom0_core.c
line diff
     1.1 --- a/xenolinux-2.4.21-sparse/arch/xeno/drivers/dom0/dom0_core.c	Tue Jul 08 15:10:23 2003 +0000
     1.2 +++ b/xenolinux-2.4.21-sparse/arch/xeno/drivers/dom0/dom0_core.c	Tue Jul 08 15:21:05 2003 +0000
     1.3 @@ -45,8 +45,9 @@ struct proc_dir_entry *xeno_base;
     1.4  static struct proc_dir_entry *dom0_cmd_intf;
     1.5  static struct proc_dir_entry *dom_list_intf;
     1.6  
     1.7 -int direct_unmap(unsigned long, unsigned long);
     1.8  int direct_unmap(struct mm_struct *, unsigned long, unsigned long);
     1.9 +unsigned long direct_mmap(unsigned long phys_addr, unsigned long size, 
    1.10 +			  pgprot_t prot, int tot_pages);
    1.11  
    1.12  static ssize_t dom_usage_read(struct file * file, char * buff, size_t size, loff_t * off)
    1.13  {
    1.14 @@ -145,113 +146,6 @@ static void create_proc_dom_entries(int 
    1.15      }
    1.16  }
    1.17  
    1.18 -static ssize_t dom_mem_write(struct file * file, const char * buff, 
    1.19 -                             size_t size , loff_t * off)
    1.20 -{
    1.21 -    dom_mem_t mem_data;
    1.22 -    
    1.23 -    printk("dom_mem_write called: Shouldn't happen.\n");
    1.24 -
    1.25 -    copy_from_user(&mem_data, (dom_mem_t *)buff, sizeof(dom_mem_t));
    1.26 -    
    1.27 -    if ( direct_unmap(mem_data.vaddr, 
    1.28 -                      mem_data.tot_pages << PAGE_SHIFT) == 0 ) {
    1.29 -        return sizeof(sizeof(dom_mem_t));
    1.30 -    } else {
    1.31 -        return -1;
    1.32 -    }
    1.33 -}
    1.34 -
    1.35 -static ssize_t dom_mem_read(struct file * file, char * buff, size_t size, loff_t * off)
    1.36 -{
    1.37 -    unsigned long addr;
    1.38 -    pgprot_t prot;
    1.39 -
    1.40 -    proc_memdata_t * mem_data = (proc_memdata_t *)((struct proc_dir_entry *)file->f_dentry->d_inode->u.generic_ip)->data;
    1.41 -
    1.42 -    prot = PAGE_SHARED; 
    1.43 -
    1.44 -    /* remap the range using xen specific routines */
    1.45 -
    1.46 -    printk("Calling direct_mmap with pfn %x, tot pages %x.\n",
    1.47 -	   mem_data->pfn, mem_data->tot_pages);
    1.48 -
    1.49 -    addr = direct_mmap(mem_data->pfn << PAGE_SHIFT, mem_data->tot_pages << PAGE_SHIFT, prot, MAP_DISCONT, mem_data->tot_pages);
    1.50 -    
    1.51 -    copy_to_user((unsigned long *)buff, &addr, sizeof(addr));
    1.52 -
    1.53 -    return sizeof(addr);
    1.54 -}
    1.55 -
    1.56 -struct file_operations dom_mem_ops = {
    1.57 -    read:    dom_mem_read,
    1.58 -    write:   dom_mem_write,
    1.59 -};
    1.60 -
    1.61 -static int dom_map_mem(unsigned int dom, unsigned long pfn, int tot_pages)
    1.62 -{
    1.63 -    int ret = -ENOENT;
    1.64 -    struct proc_dir_entry * pd = xeno_base->subdir;
    1.65 -    struct proc_dir_entry * file;
    1.66 -    proc_memdata_t * memdata;
    1.67 -
    1.68 -    while(pd != NULL){
    1.69 -
    1.70 -        if((pd->mode & S_IFDIR) && ((dom_procdata_t *)pd->data)->domain == dom){
    1.71 -
    1.72 -            /* check if there is already an entry for mem and if so
    1.73 -             * remove it.
    1.74 -             */
    1.75 -	    /* XXX does this not leak the memdata? */
    1.76 -            remove_proc_entry("mem", pd);
    1.77 -
    1.78 -            /* create new entry with parameters describing what to do
    1.79 -             * when it is mmaped.
    1.80 -             */
    1.81 -            file = create_proc_entry("mem", 0600, pd);
    1.82 -            if(file != NULL)
    1.83 -            {
    1.84 -                file->owner = THIS_MODULE;
    1.85 -                file->nlink = 1;
    1.86 -                file->proc_fops = &dom_mem_ops;
    1.87 -
    1.88 -                memdata = (proc_memdata_t *)kmalloc(sizeof(proc_memdata_t), GFP_KERNEL);
    1.89 -                memdata->pfn = pfn;
    1.90 -                memdata->tot_pages = tot_pages;
    1.91 -                file->data = memdata;
    1.92 -
    1.93 -                ret = 0;
    1.94 -                break;
    1.95 -            }
    1.96 -
    1.97 -            ret = -EAGAIN;
    1.98 -            break;
    1.99 -        }                    
   1.100 -        pd = pd->next;
   1.101 -    }
   1.102 -
   1.103 -    return ret;
   1.104 -}
   1.105 -
   1.106 -/* function used to retrieve data associated with new domain */
   1.107 -static ssize_t dom_data_read(struct file * file, char * buff, size_t size, loff_t * off)
   1.108 -{
   1.109 -    dom0_newdomain_t * dom_data = (dom0_newdomain_t *)
   1.110 -        ((struct proc_dir_entry *)file->f_dentry->d_inode->u.generic_ip)->data;
   1.111 -
   1.112 -    copy_to_user((dom0_newdomain_t *)buff, dom_data, sizeof(dom0_newdomain_t));
   1.113 -
   1.114 -    remove_proc_entry("new_dom_data", xeno_base);
   1.115 -
   1.116 -    kfree(dom_data);
   1.117 -
   1.118 -    return sizeof(dom0_newdomain_t);
   1.119 -}
   1.120 -
   1.121 -struct file_operations newdom_data_fops = {
   1.122 -    read:    dom_data_read,
   1.123 -};
   1.124 -
   1.125  static int dom0_cmd_write(struct file *file, const char *buffer, size_t size,
   1.126  			  loff_t *off)
   1.127  {
   1.128 @@ -447,7 +341,7 @@ static int handle_dom0_cmd_unmapdommem(u
   1.129      return -EFAULT;
   1.130  
   1.131    return direct_unmap(current->mm, argbuf.vaddr,
   1.132 -		      argbuf.tot_pages << PAGE_SIZE);
   1.133 +		      argbuf.tot_pages << PAGE_SHIFT);
   1.134  }
   1.135  
   1.136  static int dom0_cmd_ioctl(struct inode *inode, struct file *file,