Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Device File Virtualization Proof of Concept (Kernel+Preload)
[palacios.git] / gears / services / devfile / guest_device_setup.py
1
2
3 def main():
4         ff = open("guest_devices.txt",'r')
5         
6         count = 0
7         out = ''
8         for line in ff:
9                 count+=1
10                 this_line = '{\"'+line.strip('\n')+'\",-1},\n'
11                 out += this_line
12         out = out.rstrip('\n,')
13         out+="\n"
14         top = "#define DEV_COUNT "+str(count)+"\n"
15         
16         ff.close()
17         
18         writeable = open("dev_file_guest_fd_tracker.h",'r');
19         lst = writeable.readlines()
20         writeable.close()
21         count = 0
22         for line in lst:
23                 count+=1
24                 if 'PYTHONSCRIPTBREAK1' in line:
25                         index1 = count
26                 if 'PYTHONSCRIPTBREAK3' in line:
27                         index2 = count
28                 if 'PYTHONSCRIPTBREAK4' in line:
29                         index3 = count
30         
31         lst.pop(index1)
32         lst.insert(index1,top)
33         subcount = index3-2
34         while(subcount>= index2):
35                 lst.pop(subcount)
36                 subcount-=1
37         lst.insert(index2,out)
38         writeable = open("dev_file_guest_fd_tracker.h",'w');
39         writeable.write(''.join(lst))
40         writeable.close()
41         return
42         
43
44 if __name__ == "__main__":
45     main()