]> git.pld-linux.org Git - packages/xen.git/blob - python-fixes.patch
- python fixes from upstream
[packages/xen.git] / python-fixes.patch
1 diff -urN xen-4.16.2.orig/tools/misc/Makefile xen-4.16.2/tools/misc/Makefile
2 --- xen-4.16.2.orig/tools/misc/Makefile 2022-08-18 13:47:46.000000000 +0200
3 +++ xen-4.16.2/tools/misc/Makefile      2023-07-23 20:27:26.104773461 +0200
4 @@ -13,7 +13,6 @@
5  # Everything to be installed in regular bin/
6  INSTALL_BIN-$(CONFIG_X86)      += xen-cpuid
7  INSTALL_BIN-$(CONFIG_X86)      += xen-detect
8 -INSTALL_BIN                    += xencons
9  INSTALL_BIN                    += xencov_split
10  INSTALL_BIN += $(INSTALL_BIN-y)
11  
12 @@ -45,7 +44,6 @@
13  TARGETS_ALL := $(INSTALL_BIN) $(INSTALL_SBIN) $(INSTALL_PRIVBIN)
14  
15  # Everything which only needs copying to install
16 -TARGETS_COPY += xencons
17  TARGETS_COPY += xencov_split
18  TARGETS_COPY += xenpvnetboot
19  
20 diff -urN xen-4.16.2.orig/tools/misc/xencons xen-4.16.2/tools/misc/xencons
21 --- xen-4.16.2.orig/tools/misc/xencons  2023-07-23 20:27:00.747415202 +0200
22 +++ xen-4.16.2/tools/misc/xencons       1970-01-01 01:00:00.000000000 +0100
23 @@ -1,92 +0,0 @@
24 -#!/usr/bin/python2
25 -
26 -##############################################
27 -# Console client for Xen guest OSes
28 -# Copyright (c) 2004, K A Fraser
29 -##############################################
30 -
31 -import errno, os, signal, socket, struct, sys
32 -
33 -from termios import *
34 -# Indexes into termios.tcgetattr() list.
35 -IFLAG  = 0
36 -OFLAG  = 1
37 -CFLAG  = 2
38 -LFLAG  = 3
39 -ISPEED = 4
40 -OSPEED = 5
41 -CC     = 6
42 -
43 -def __child_death(signum, frame):
44 -    global stop
45 -    stop = True
46 -
47 -def __recv_from_sock(sock):
48 -    global stop
49 -    stop = False
50 -    while not stop:
51 -        try:
52 -            data = sock.recv(1024)
53 -        except socket.error, error:
54 -            if error[0] != errno.EINTR:
55 -                raise
56 -        else:
57 -            try:
58 -                os.write(1, data)
59 -            except os.error, error:
60 -                if error[0] != errno.EINTR:
61 -                    raise
62 -    os.wait()
63 -
64 -def __send_to_sock(sock):
65 -    while 1:
66 -        try:
67 -            data = os.read(0,1024)
68 -        except os.error, error:
69 -            if error[0] != errno.EINTR:
70 -                raise
71 -        else:
72 -            if ord(data[0]) == ord(']')-64:
73 -                break
74 -            try:
75 -                sock.send(data)
76 -            except socket.error, error:
77 -                if error[0] == errno.EPIPE:
78 -                    sys.exit(0)
79 -                if error[0] != errno.EINTR:
80 -                    raise
81 -    sys.exit(0)
82 -
83 -def connect(host,port):
84 -    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM, 0)
85 -    sock.connect((host,port))
86 -
87 -    oattrs = tcgetattr(0)
88 -    nattrs = tcgetattr(0)
89 -    nattrs[IFLAG] = nattrs[IFLAG] & ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON)
90 -    nattrs[OFLAG] = nattrs[OFLAG] & ~(OPOST)
91 -    nattrs[CFLAG] = nattrs[CFLAG] & ~(CSIZE | PARENB)
92 -    nattrs[CFLAG] = nattrs[CFLAG] | CS8
93 -    nattrs[LFLAG] = nattrs[LFLAG] & ~(ECHO | ICANON | IEXTEN | ISIG)
94 -    nattrs[CC][VMIN] = 1
95 -    nattrs[CC][VTIME] = 0
96 -
97 -    if os.fork():
98 -        signal.signal(signal.SIGCHLD, __child_death)
99 -        print "************ REMOTE CONSOLE: CTRL-] TO QUIT ********"
100 -        tcsetattr(0, TCSAFLUSH, nattrs)
101 -        try:
102 -            __recv_from_sock(sock)
103 -        finally:
104 -            tcsetattr(0, TCSAFLUSH, oattrs)
105 -            print
106 -            print "************ REMOTE CONSOLE EXITED *****************"
107 -    else:
108 -        signal.signal(signal.SIGPIPE, signal.SIG_IGN)
109 -        __send_to_sock(sock)
110 -
111 -if __name__ == '__main__':
112 -    if len(sys.argv) != 3:
113 -        print sys.argv[0] + " <host> <port>"
114 -        sys.exit(1)
115 -    connect(str(sys.argv[1]),int(sys.argv[2]))
116 diff -urN xen-4.16.2.orig/tools/misc/xencov_split xen-4.16.2/tools/misc/xencov_split
117 --- xen-4.16.2.orig/tools/misc/xencov_split     2023-07-23 20:27:00.747415202 +0200
118 +++ xen-4.16.2/tools/misc/xencov_split  2023-07-23 20:27:33.481877687 +0200
119 @@ -94,4 +94,3 @@
120          sys.exit(1)
121      except KeyboardInterrupt:
122          sys.exit(1)
123 -
124 diff -urN xen-4.16.2.orig/tools/pygrub/Makefile xen-4.16.2/tools/pygrub/Makefile
125 --- xen-4.16.2.orig/tools/pygrub/Makefile       2022-08-18 13:47:46.000000000 +0200
126 +++ xen-4.16.2/tools/pygrub/Makefile    2023-07-23 20:27:33.481877687 +0200
127 @@ -6,19 +6,22 @@
128  PY_LDFLAGS = $(SHLIB_LDFLAGS) $(APPEND_LDFLAGS)
129  INSTALL_LOG = build/installed_files.txt
130  
131 +setup.py = CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" LDFLAGS="$(PY_LDFLAGS)" \
132 +           $(PYTHON) setup.py
133 +
134  .PHONY: all
135  all: build
136  .PHONY: build
137  build:
138 -       CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py build
139 +       $(setup.py) build
140  
141  .PHONY: install
142  install: all
143         $(INSTALL_DIR) $(DESTDIR)/$(bindir)
144 -       CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDSHARED="$(CC)" \
145 -               LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) setup.py install \
146 -               --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
147 -                --root="$(DESTDIR)" --install-scripts=$(LIBEXEC_BIN) --force
148 +       $(INSTALL_DIR) $(DESTDIR)/$(LIBEXEC_BIN)
149 +       $(setup.py) install --record $(INSTALL_LOG) $(PYTHON_PREFIX_ARG) \
150 +               --root="$(DESTDIR)" --force
151 +       $(INSTALL_PYTHON_PROG) src/pygrub $(DESTDIR)/$(LIBEXEC_BIN)/pygrub
152         set -e; if [ $(bindir) != $(LIBEXEC_BIN) -a \
153                      "`readlink -f $(DESTDIR)/$(bindir)`" != \
154                      "`readlink -f $(LIBEXEC_BIN)`" ]; then \
155 diff -urN xen-4.16.2.orig/tools/pygrub/setup.py xen-4.16.2/tools/pygrub/setup.py
156 --- xen-4.16.2.orig/tools/pygrub/setup.py       2022-08-18 13:47:46.000000000 +0200
157 +++ xen-4.16.2/tools/pygrub/setup.py    2023-07-23 20:27:33.481877687 +0200
158 @@ -23,7 +23,6 @@
159        author_email='katzj@redhat.com',
160        license='GPL',
161        package_dir={'grub': 'src', 'fsimage': 'src'},
162 -      scripts = ["src/pygrub"],
163        packages=pkgs,
164        ext_modules = [ xenfsimage ]
165        )
166 diff -urN xen-4.16.2.orig/tools/pygrub/src/ExtLinuxConf.py xen-4.16.2/tools/pygrub/src/ExtLinuxConf.py
167 --- xen-4.16.2.orig/tools/pygrub/src/ExtLinuxConf.py    2022-08-18 13:47:46.000000000 +0200
168 +++ xen-4.16.2/tools/pygrub/src/ExtLinuxConf.py 2023-07-23 20:27:33.482877701 +0200
169 @@ -207,7 +207,7 @@
170                   "f1": None,
171                   "f2": None,
172                   }
173 -        
174 +
175  if __name__ == "__main__":
176      if len(sys.argv) < 2:
177          raise RuntimeError("Need a configuration file to read")
178 diff -urN xen-4.16.2.orig/tools/pygrub/src/fsimage/fsimage.c xen-4.16.2/tools/pygrub/src/fsimage/fsimage.c
179 --- xen-4.16.2.orig/tools/pygrub/src/fsimage/fsimage.c  2022-08-18 13:47:46.000000000 +0200
180 +++ xen-4.16.2/tools/pygrub/src/fsimage/fsimage.c       2023-07-23 20:27:33.482877701 +0200
181 @@ -31,7 +31,7 @@
182         fsi_t *fs;
183  } fsimage_fs_t;
184  
185 -typedef struct fsimage_file { 
186 +typedef struct fsimage_file {
187         PyObject_HEAD
188         fsimage_fs_t *fs;
189         fsi_file_t *file;
190 @@ -47,7 +47,7 @@
191         ssize_t bytesread = 0;
192         PyObject * buffer;
193  
194 -       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iL", kwlist, 
195 +       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iL", kwlist,
196             &size, &offset))
197                 return (NULL);
198  
199 @@ -62,7 +62,7 @@
200  
201         if (buffer == NULL)
202                 return (NULL);
203
204 +
205         while (1) {
206                 int err;
207                 void *buf =
208 @@ -255,7 +255,7 @@
209         uint64_t offset = 0;
210         fsimage_fs_t *fs;
211  
212 -       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|Ls", kwlist, 
213 +       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s|Ls", kwlist,
214             &name, &offset, &options))
215                 return (NULL);
216  
217 diff -urN xen-4.16.2.orig/tools/pygrub/src/GrubConf.py xen-4.16.2/tools/pygrub/src/GrubConf.py
218 --- xen-4.16.2.orig/tools/pygrub/src/GrubConf.py        2022-08-18 13:47:46.000000000 +0200
219 +++ xen-4.16.2/tools/pygrub/src/GrubConf.py     2023-07-23 20:27:33.482877701 +0200
220 @@ -95,7 +95,7 @@
221          self.title = title.strip()
222  
223      def __repr__(self):
224 -        return ("title: %s\n" 
225 +        return ("title: %s\n"
226                  "  root: %s\n"
227                  "  kernel: %s\n"
228                  "  args: %s\n"
229 @@ -140,7 +140,7 @@
230  class GrubImage(_GrubImage):
231      def __init__(self, title, lines):
232          _GrubImage.__init__(self, title, lines)
233 -    
234 +
235      def set_from_line(self, line, replace = None):
236          (com, arg) = grub_exact_split(line, 2)
237  
238 @@ -265,7 +265,7 @@
239  class GrubConfigFile(_GrubConfigFile):
240      def __init__(self, fn = None):
241          _GrubConfigFile.__init__(self,fn)
242 -        
243 +
244      def new_image(self, title, lines):
245          return GrubImage(title, lines)
246  
247 @@ -297,7 +297,7 @@
248                  img = []
249                  title = l[6:]
250                  continue
251 -                
252 +
253              if img is not None:
254                  img.append(l)
255                  continue
256 @@ -310,7 +310,7 @@
257                      logging.info("Ignored directive %s" %(com,))
258              else:
259                  logging.warning("Unknown directive %s" %(com,))
260 -                
261 +
262          if img:
263              self.add_image(GrubImage(title, img))
264  
265 @@ -322,7 +322,7 @@
266      com="set:" + com
267      m = re.match("([\"\'])(.*)\\1", arg)
268      if m is not None:
269 -        arg=m.group(2) 
270 +        arg=m.group(2)
271      return (com,arg)
272  
273  class Grub2Image(_GrubImage):
274 @@ -334,7 +334,7 @@
275  
276          if com == "set":
277              (com,arg) = grub2_handle_set(arg)
278 -            
279 +
280          if com in self.commands:
281              if self.commands[com] is not None:
282                  setattr(self, self.commands[com], arg.strip())
283 @@ -351,7 +351,7 @@
284          else:
285              self.lines.pop(replace)
286              self.lines.insert(replace, line)
287 -                
288 +
289      commands = {'set:root': 'root',
290                  'linux': 'kernel',
291                  'linux16': 'kernel',
292 @@ -360,14 +360,14 @@
293                  'echo': None,
294                  'insmod': None,
295                  'search': None}
296 -    
297 +
298  class Grub2ConfigFile(_GrubConfigFile):
299      def __init__(self, fn = None):
300          _GrubConfigFile.__init__(self, fn)
301 -       
302 +
303      def new_image(self, title, lines):
304          return Grub2Image(title, lines)
305
306 +
307      def parse(self, buf = None):
308          if buf is None:
309              if self.filename is None:
310 @@ -431,10 +431,10 @@
311                  continue
312  
313              (com, arg) = grub_exact_split(l, 2)
314 -        
315 +
316              if com == "set":
317                  (com,arg) = grub2_handle_set(arg)
318 -                
319 +
320              if com in self.commands:
321                  if self.commands[com] is not None:
322                      arg_strip = arg.strip()
323 @@ -448,7 +448,7 @@
324                  pass
325              else:
326                  logging.warning("Unknown directive %s" %(com,))
327 -            
328 +
329          if img is not None:
330              raise RuntimeError("syntax error: end of file with open menuentry(%d %s)" % (len(img),img))
331  
332 @@ -466,7 +466,7 @@
333                  'if': None,
334                  'fi': None,
335                  }
336 -        
337 +
338  if __name__ == "__main__":
339      if len(sys.argv) < 3:
340          raise RuntimeError('Need a grub version ("grub" or "grub2") and a grub.conf or grub.cfg to read')
341 diff -urN xen-4.16.2.orig/tools/pygrub/src/pygrub xen-4.16.2/tools/pygrub/src/pygrub
342 --- xen-4.16.2.orig/tools/pygrub/src/pygrub     2023-07-23 20:27:00.751415259 +0200
343 +++ xen-4.16.2/tools/pygrub/src/pygrub  2023-07-23 20:27:33.483877715 +0200
344 @@ -46,7 +46,7 @@
345          val = 2
346      else:
347          val = 0
348 -        
349 +
350      try:
351          curses.curs_set(val)
352      except _curses.error:
353 @@ -114,7 +114,7 @@
354  def get_partition_offsets(file):
355      image_type = identify_disk_image(file)
356      if image_type == DISK_TYPE_RAW:
357 -        # No MBR: assume whole disk filesystem, which is like a 
358 +        # No MBR: assume whole disk filesystem, which is like a
359          # single partition starting at 0
360          return [0]
361      elif image_type == DISK_TYPE_HYBRIDISO:
362 @@ -136,7 +136,7 @@
363          partbuf = buf[poff:poff+16]
364          offset  = struct.unpack("<L", partbuf[8:12])[0] * SECTOR_SIZE
365          type    = struct.unpack("<B", partbuf[4:5])[0]
366 -        
367 +
368          # offset == 0 implies this partition is not enabled
369          if offset == 0:
370              offzerocount += 1
371 @@ -176,7 +176,7 @@
372          screen.noutrefresh()
373          win = curses.newwin(1, 74, startx, starty + 2)
374          curses.textpad.Textbox.__init__(self, win)
375 -        
376 +
377          self.line = list(line)
378          self.pos = len(line)
379          self.cancelled = False
380 @@ -242,7 +242,7 @@
381          if self.cancelled:
382              return None
383          return string.join(self.line, "")
384 -        
385 +
386  
387  class Grub:
388      ENTRY_WIN_LINES = 8
389 @@ -266,7 +266,7 @@
390              self.entry_win = curses.newwin(Grub.ENTRY_WIN_LINES + 2, 74, 2, 1)
391              self.text_win = curses.newwin(10, 70, 12, 5)
392              curses.def_prog_mode()
393 -        
394 +
395          curses.reset_prog_mode()
396          self.screen.erase()
397  
398 @@ -284,7 +284,7 @@
399              self.start_image = self.selected_image
400          if self.selected_image < self.start_image:
401              self.start_image = self.selected_image
402 -        
403 +
404          for y in range(self.start_image, len(self.cf.images)):
405              i = self.cf.images[y]
406              if y > self.start_image + maxy:
407 @@ -334,7 +334,7 @@
408                  l = img.lines[idx].expandtabs().ljust(70)
409                  if len(l) > 70:
410                      l = l[:69] + ">"
411 -                    
412 +
413                  self.entry_win.addstr(idp, 2, l)
414                  if idx == curline:
415                      self.entry_win.attroff(curses.A_REVERSE)
416 @@ -372,7 +372,7 @@
417                  self.command_line_mode()
418                  if self.isdone:
419                      return
420 -                
421 +
422              # bound at the top and bottom
423              if curline < 0:
424                  curline = 0
425 @@ -405,7 +405,7 @@
426          lines = []
427          while 1:
428              t = GrubLineEditor(self.screen, y, 2)
429 -            enable_cursor(True)            
430 +            enable_cursor(True)
431              ret = t.edit()
432              if ret:
433                  if ret in ("quit", "return"):
434 @@ -415,7 +415,7 @@
435                      lines.append(ret)
436                      continue
437  
438 -                # if we got boot, then we want to boot the entered image 
439 +                # if we got boot, then we want to boot the entered image
440                  img = self.cf.new_image("entered", lines)
441                  self.cf.add_image(img)
442                  self.selected_image = len(self.cf.images) - 1
443 @@ -428,7 +428,7 @@
444      def read_config(self, fn, fs = None):
445          """Read the given file to parse the config.  If fs = None, then
446          we're being given a raw config file rather than a disk image."""
447 -        
448 +
449          if not os.access(fn, os.R_OK):
450              raise RuntimeError("Unable to access %s" %(fn,))
451  
452 @@ -504,7 +504,7 @@
453          while not self.isdone:
454              self.run_main(timeout)
455              timeout = -1
456 -            
457 +
458          return self.selected_image
459  
460      def run_main(self, timeout = -1):
461 @@ -534,7 +534,7 @@
462          self.start_image = 0
463          while (timeout == -1 or mytime < int(timeout)):
464              draw()
465 -            if timeout != -1 and mytime != -1: 
466 +            if timeout != -1 and mytime != -1:
467                  self.screen.addstr(20, 5, "Will boot selected entry in %2d seconds"
468                                     %(int(timeout) - mytime))
469              else:
470 @@ -605,7 +605,7 @@
471                  self.selected_image = 0
472              elif self.selected_image >= len(self.cf.images):
473                  self.selected_image = len(self.cf.images) - 1
474 -        
475 +
476  def get_entry_idx(cf, entry):
477      # first, see if the given entry is numeric
478      try:
479 @@ -702,10 +702,10 @@
480      # Unpleasant. Typically we'll have 'root=foo -k' or 'root=foo /kernel -k',
481      # and we need to maintain Xen properties (root= and ip=) and the kernel
482      # before any user args.
483 -    
484 +
485      xenargs = ""
486      userargs = ""
487 -    
488 +
489      if not cfg["args"]:
490          cfg["args"] = cfg["kernel"]
491      else:
492 @@ -717,7 +717,7 @@
493          cfg["args"] = xenargs + " " + cfg["kernel"] + " " + userargs
494  
495      return cfg
496
497 +
498  def sniff_netware(fs, cfg):
499      if not fs.file_exists("/nwserver/xnloader.sys"):
500          return cfg
501 @@ -734,7 +734,7 @@
502      if args:
503          s += "(args %s)" % repr(args)
504      return s
505 -                
506 +
507  def format_simple(kernel, ramdisk, args, sep):
508      for check in (kernel, ramdisk, args):
509          if check is not None and sep in check:
510 @@ -749,7 +749,7 @@
511  
512  if __name__ == "__main__":
513      sel = None
514 -    
515 +
516      def usage():
517          print("Usage: %s [-q|--quiet] [-i|--interactive] [-l|--list-entries] [-n|--not-really] [--output=] [--kernel=] [--ramdisk=] [--args=] [--entry=] [--output-directory=] [--output-format=sxp|simple|simple0] [--offset=] <image>" %(sys.argv[0],), file=sys.stderr)
518  
519 @@ -788,7 +788,7 @@
520          opts, args = getopt.gnu_getopt(sys.argv[1:], 'qilnh::',
521                                     ["quiet", "interactive", "list-entries", "not-really", "help",
522                                      "output=", "output-format=", "output-directory=", "offset=",
523 -                                    "entry=", "kernel=", 
524 +                                    "entry=", "kernel=",
525                                      "ramdisk=", "args=", "isconfig", "debug"])
526      except getopt.GetoptError:
527          usage()
528 @@ -972,4 +972,4 @@
529          os.write(fd, ostring)
530      else:
531          os.write(fd, ostring.encode())
532 -    
533 +
534 diff -urN xen-4.16.2.orig/tools/python/Makefile xen-4.16.2/tools/python/Makefile
535 --- xen-4.16.2.orig/tools/python/Makefile       2022-08-18 13:47:46.000000000 +0200
536 +++ xen-4.16.2/tools/python/Makefile    2023-07-23 20:27:33.483877715 +0200
537 @@ -36,7 +36,7 @@
538  
539  .PHONY: test
540  test:
541 -       LD_LIBRARY_PATH=$$(readlink -f ../libs/ctrl):$$(readlink -f ../xenstore) $(PYTHON) -m unittest discover
542 +       LD_LIBRARY_PATH=$$(readlink -f ../libs/ctrl):$$(readlink -f ../xenstore) $(PYTHON) -m unittest discover -v
543  
544  .PHONY: clean
545  clean:
546 diff -urN xen-4.16.2.orig/tools/python/pylintrc xen-4.16.2/tools/python/pylintrc
547 --- xen-4.16.2.orig/tools/python/pylintrc       2022-08-18 13:47:46.000000000 +0200
548 +++ xen-4.16.2/tools/python/pylintrc    1970-01-01 01:00:00.000000000 +0100
549 @@ -1,307 +0,0 @@
550 -# lint Python modules using external checkers.                            
551 -#                                                                                
552 -#     This is the main checker controling the other ones and the reports         
553 -#     generation. It is itself both a raw checker and an astng checker in order  
554 -#     to:                                                                        
555 -#     * handle message activation / deactivation at the module level             
556 -#     * handle some basic but necessary stats'data (number of classes, methods...)
557 -#                                                                                 
558 -# This checker also defines the following reports:                                    
559 -#   * R0001: Total errors / warnings                                              
560 -#   * R0002: % errors / warnings by module                                        
561 -#   * R0003: Messages                                                             
562 -#   * R0004: Global evaluation                                                    
563 -# 
564 -[MASTER]
565 -# Add <file or directory> to the black list. It should be a base name, not a
566 -# path. You may set this option multiple times.
567 -ignore=CVS
568 -
569 -# Pickle collected data for later comparisons.
570 -persistent=yes
571 -
572 -# Set the cache size for astng objects.
573 -cache-size=500
574 -
575 -
576 -
577 -[REPORTS]
578 -# Tells wether to display a full report or only the messages
579 -reports=yes
580 -
581 -# Use HTML as output format instead of text
582 -html=no
583 -
584 -# Use a parseable text output format, so your favorite text editor will be able
585 -# to jump to the line corresponding to a message.
586 -parseable=no
587 -
588 -# Colorizes text output using ansi escape codes
589 -color=no
590 -
591 -# Put messages in a separate file for each module / package specified on the
592 -# command line instead of printing them on stdout. Reports (if any) will be
593 -# written in a file name "pylint_global.[txt|html]".
594 -files-output=no
595 -
596 -# Python expression which should return a note less than 10 (10 is the highest
597 -# note).You have access to the variables errors warning, statement which
598 -# respectivly contain the number of errors / warnings messages and the total
599 -# number of statements analyzed. This is used by the global evaluation report
600 -# (R0004).
601 -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
602 -
603 -# Add a comment according to your evaluation note. This is used by the global
604 -# evaluation report (R0004).
605 -comment=no
606 -
607 -# Include message's id in output
608 -include-ids=yes
609 -
610 -
611 -
612 -# checks for                                                              
613 -#     * unused variables / imports                                               
614 -#     * undefined variables                                                      
615 -#     * redefinition of variable from builtins or from an outer scope            
616 -#     * use of variable before assigment                                         
617 -#     
618 -[VARIABLES]
619 -# Enable / disable this checker
620 -enable-variables=yes
621 -
622 -# Tells wether we should check for unused import in __init__ files.
623 -init-import=no
624 -
625 -# List of variable names used for dummy variables (i.e. not used).
626 -dummy-variables=_,_1,_2,_3,_4,_5,dummy
627 -
628 -
629 -
630 -# checks for :                                                            
631 -#     * doc strings                                                              
632 -#     * modules / classes / functions / methods / arguments / variables name     
633 -#     * number of arguments, local variables, branchs, returns and statements in
634 -# functions, methods                                                       
635 -#     * required module attributes                                             
636 -#     * dangerous default values as arguments                                    
637 -#     * redefinition of function / method / class                                
638 -#     * uses of the global statement                                             
639 -#                                                                                 
640 -# This checker also defines the following reports:                                    
641 -#   * R0101: Statistics by type                                                   
642 -# 
643 -[BASIC]
644 -# Enable / disable this checker
645 -enable-basic=yes
646 -
647 -# Required attributes for module, separated by a comma
648 -required-attributes=
649 -
650 -# Regular expression which should only match functions or classes name which do
651 -# not require a docstring
652 -no-docstring-rgx=.*
653 -
654 -# Minimal length for module / class / function / method / argument / variable
655 -# names
656 -min-name-length=1
657 -
658 -# Regular expression which should only match correct module names
659 -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
660 -
661 -# Regular expression which should only match correct class names
662 -class-rgx=[A-Z_][a-zA-Z0-9]+$
663 -
664 -# Regular expression which should only match correct function names
665 -function-rgx=[a-z_][A-Za-z0-9_]*$
666 -
667 -# Regular expression which should only match correct method names
668 -method-rgx=[a-z_][A-Za-z0-9_]*$
669 -
670 -# Regular expression which should only match correct argument names
671 -argument-rgx=[a-z_][A-Za-z0-9_]*$
672 -
673 -# Regular expression which should only match correct variable names
674 -variable-rgx=[a-z_][A-Za-z0-9_]*$
675 -
676 -# Good variable names which should always be accepted, separated by a comma
677 -good-names=i,j,k,ex,Run,_
678 -
679 -# Bad variable names which should always be refused, separated by a comma
680 -bad-names=foo,bar,baz,toto,tutu,tata
681 -
682 -# List of builtins function names that should not be used, separated by a comma
683 -bad-functions=apply,input
684 -
685 -
686 -
687 -# checks for sign of poor/misdesign:                                      
688 -#     * number of methods, attributes, local variables...                        
689 -#     * size, complexity of functions, methods                                   
690 -#     
691 -[DESIGN]
692 -# Enable / disable this checker
693 -enable-design=yes
694 -
695 -# Maximum number of arguments for function / method
696 -max-args=15
697 -
698 -# Maximum number of locals for function / method body
699 -max-locals=15
700 -
701 -# Maximum number of return / yield for function / method body
702 -max-returns=6
703 -
704 -# Maximum number of branch for function / method body
705 -max-branchs=12
706 -
707 -# Maximum number of statements in function / method body
708 -max-statements=50
709 -
710 -# Maximum number of parents for a class (see R0901).
711 -max-parents=7
712 -
713 -# Maximum number of attributes for a class (see R0902).
714 -max-attributes=7
715 -
716 -# Minimum number of public methods for a class (see R0903).
717 -min-public-methods=2
718 -
719 -# Maximum number of public methods for a class (see R0904).
720 -max-public-methods=20
721 -
722 -
723 -
724 -# checks for :                                                            
725 -#     * methods without self as first argument                                   
726 -#     * overriden methods signature                                              
727 -#     * access only to existant members via self                                 
728 -#     * attributes not defined in the __init__ method                            
729 -#     * supported interfaces implementation                                      
730 -#     * unreachable code                                                         
731 -#     
732 -[CLASSES]
733 -# Enable / disable this checker
734 -enable-classes=yes
735 -
736 -# List of interface methods to ignore, separated by a comma. This is used for
737 -# instance to not check methods defines in Zope's Interface base class.
738 -ignore-iface-methods=isImplementedBy,deferred,extends,names,namesAndDescriptions,queryDescriptionFor,getBases,getDescriptionFor,getDoc,getName,getTaggedValue,getTaggedValueTags,isEqualOrExtendedBy,setTaggedValue,isImplementedByInstancesOf,adaptWith,is_implemented_by
739 -
740 -# Tells wether missing members accessed in mixin class should be ignored. A
741 -# mixin class is detected if its name ends with "mixin" (case insensitive).
742 -ignore-mixin-members=yes
743 -
744 -
745 -
746 -# checks for                                                              
747 -#     * external modules dependencies                                            
748 -#     * relative / wildcard imports                                                         
749 -#     * cyclic imports                                                           
750 -#     * uses of deprecated modules
751 -#                                                                                 
752 -# This checker also defines the following reports:                                    
753 -#   * R0401: External dependencies                                                
754 -#   * R0402: Modules dependencies graph                                           
755 -# 
756 -[IMPORTS]
757 -# Enable / disable this checker
758 -enable-imports=no
759 -
760 -# Deprecated modules which should not be used, separated by a comma
761 -deprecated-modules=regsub,string,TERMIOS,Bastion,rexec
762 -
763 -# Create a graph of every (i.e. internal and external) dependencies in the given
764 -# file (report R0402 must not be disabled)
765 -import-graph=
766 -
767 -# Create a graph of external dependencies in the given file (report R0402 must
768 -# not be disabled)
769 -ext-import-graph=
770 -
771 -# Create a graph of internal dependencies in the given file (report R0402 must
772 -# not be disabled)
773 -int-import-graph=
774 -
775 -
776 -
777 -# checks for                                                              
778 -#     * excepts without exception filter                                         
779 -#     * string exceptions                                                        
780 -#     
781 -[EXCEPTIONS]
782 -# Enable / disable this checker
783 -enable-exceptions=yes
784 -
785 -
786 -
787 -# checks for :                                                            
788 -#     * unauthorized constructions                                               
789 -#     * strict indentation                                                       
790 -#     * line length                                                              
791 -#     * use of <> instead of !=
792 -#     
793 -[FORMAT]
794 -# Enable / disable this checker
795 -enable-format=no
796 -
797 -# Maximum number of characters on a single line.
798 -max-line-length=80
799 -
800 -# Maximum number of lines in a module
801 -max-module-lines=1000
802 -
803 -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 tab).
804 -indent-string='    '
805 -
806 -
807 -
808 -# does not check anything but gives some raw metrics :                    
809 -#     * total number of lines                                                    
810 -#     * total number of code lines                                               
811 -#     * total number of docstring lines                                          
812 -#     * total number of comments lines                                           
813 -#     * total number of empty lines                                              
814 -#                                                                                 
815 -# This checker also defines the following reports:                                    
816 -#   * R0701: Raw metrics                                                          
817 -# 
818 -[METRICS]
819 -# Enable / disable this checker
820 -enable-metrics=yes
821 -
822 -
823 -
824 -# checks for:                                                             
825 -#     * warning notes in the code like FIXME, XXX                                
826 -#     * PEP 263: source code with non ascii character but no encoding declaration
827 -#     
828 -[MISCELLANEOUS]
829 -# Enable / disable this checker
830 -enable-miscellaneous=yes
831 -
832 -# List of note tags to take in consideration, separated by a comma. Default to
833 -# FIXME, XXX, TODO
834 -notes=FIXME,XXX,TODO
835 -
836 -
837 -
838 -# checks for similarities and duplicated code. This computation may be
839 -#     memory / CPU intensive, so you should disable it if you experiments some
840 -#     problems.
841 -#                                                                                 
842 -# This checker also defines the following reports:                                    
843 -#   * R0801: Duplication                                                          
844 -# 
845 -[SIMILARITIES]
846 -# Enable / disable this checker
847 -enable-similarities=yes
848 -
849 -# Minimum lines number of a similarity.
850 -min-similarity-lines=4
851 -
852 -# Ignore comments when computing similarities.
853 -ignore-comments=yes
854 -
855 -
856 -
857 diff -urN xen-4.16.2.orig/tools/python/xen/lowlevel/xc/xc.c xen-4.16.2/tools/python/xen/lowlevel/xc/xc.c
858 --- xen-4.16.2.orig/tools/python/xen/lowlevel/xc/xc.c   2022-08-18 13:47:46.000000000 +0200
859 +++ xen-4.16.2/tools/python/xen/lowlevel/xc/xc.c        2023-07-23 20:27:33.484877729 +0200
860 @@ -1,6 +1,6 @@
861  /******************************************************************************
862   * Xc.c
863 - * 
864 + *
865   * Copyright (c) 2003-2004, K A Fraser (University of Cambridge)
866   */
867  
868 @@ -107,7 +107,7 @@
869  
870      if ( xc_domain_dumpcore(self->xc_handle, dom, corefile) != 0 )
871          return pyxc_error_to_exception(self->xc_handle);
872 -    
873 +
874      Py_INCREF(zero);
875      return zero;
876  }
877 @@ -142,7 +142,7 @@
878          return NULL;
879      if ( pyhandle != NULL )
880      {
881 -        if ( !PyList_Check(pyhandle) || 
882 +        if ( !PyList_Check(pyhandle) ||
883               (PyList_Size(pyhandle) != sizeof(xen_domain_handle_t)) )
884              goto out_exception;
885  
886 @@ -190,7 +190,7 @@
887  
888      if (xc_domain_max_vcpus(self->xc_handle, dom, max) != 0)
889          return pyxc_error_to_exception(self->xc_handle);
890 -    
891 +
892      Py_INCREF(zero);
893      return zero;
894  }
895 @@ -225,7 +225,7 @@
896  
897      if ( xc_domain_shutdown(self->xc_handle, dom, reason) != 0 )
898          return pyxc_error_to_exception(self->xc_handle);
899 -    
900 +
901      Py_INCREF(zero);
902      return zero;
903  }
904 @@ -257,7 +257,7 @@
905  
906      static char *kwd_list[] = { "domid", "vcpu", "cpumap", NULL };
907  
908 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|iO", kwd_list, 
909 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|iO", kwd_list,
910                                        &dom, &vcpu, &cpulist) )
911          return NULL;
912  
913 @@ -271,7 +271,7 @@
914  
915      if ( (cpulist != NULL) && PyList_Check(cpulist) )
916      {
917 -        for ( i = 0; i < PyList_Size(cpulist); i++ ) 
918 +        for ( i = 0; i < PyList_Size(cpulist); i++ )
919          {
920              long cpu = PyLongOrInt_AsLong(PyList_GetItem(cpulist, i));
921              if ( cpu < 0 || cpu >= nr_cpus )
922 @@ -284,7 +284,7 @@
923              cpumap[cpu / 8] |= 1 << (cpu % 8);
924          }
925      }
926 -  
927 +
928      if ( xc_vcpu_setaffinity(self->xc_handle, dom, vcpu, cpumap,
929                               NULL, XEN_VCPUAFFINITY_HARD) != 0 )
930      {
931 @@ -292,7 +292,7 @@
932          return pyxc_error_to_exception(self->xc_handle);
933      }
934      Py_INCREF(zero);
935 -    free(cpumap); 
936 +    free(cpumap);
937      return zero;
938  }
939  
940 @@ -306,7 +306,7 @@
941      if (!PyArg_ParseTuple(args, "iO", &dom, &pyhandle))
942          return NULL;
943  
944 -    if ( !PyList_Check(pyhandle) || 
945 +    if ( !PyList_Check(pyhandle) ||
946           (PyList_Size(pyhandle) != sizeof(xen_domain_handle_t)) )
947      {
948          goto out_exception;
949 @@ -322,7 +322,7 @@
950  
951      if (xc_domain_sethandle(self->xc_handle, dom, handle) < 0)
952          return pyxc_error_to_exception(self->xc_handle);
953 -    
954 +
955      Py_INCREF(zero);
956      return zero;
957  
958 @@ -344,7 +344,7 @@
959      xc_dominfo_t *info;
960  
961      static char *kwd_list[] = { "first_dom", "max_doms", NULL };
962 -    
963 +
964      if ( !PyArg_ParseTupleAndKeywords(args, kwds, "|ii", kwd_list,
965                                        &first_dom, &max_doms) )
966          return NULL;
967 @@ -417,7 +417,7 @@
968      int nr_cpus;
969  
970      static char *kwd_list[] = { "domid", "vcpu", NULL };
971 -    
972 +
973      if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
974                                        &dom, &vcpu) )
975          return NULL;
976 @@ -472,7 +472,7 @@
977      int param;
978      uint64_t value;
979  
980 -    static char *kwd_list[] = { "domid", "param", NULL }; 
981 +    static char *kwd_list[] = { "domid", "param", NULL };
982      if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwd_list,
983                                        &dom, &param) )
984          return NULL;
985 @@ -492,7 +492,7 @@
986      int param;
987      uint64_t value;
988  
989 -    static char *kwd_list[] = { "domid", "param", "value", NULL }; 
990 +    static char *kwd_list[] = { "domid", "param", "value", NULL };
991      if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiL", kwd_list,
992                                        &dom, &param, &value) )
993          return NULL;
994 @@ -662,7 +662,7 @@
995  
996      if ( rc < 0 )
997      {
998 -        free(sdev_array); 
999 +        free(sdev_array);
1000          return pyxc_error_to_exception(self->xc_handle);
1001      }
1002  
1003 @@ -785,7 +785,7 @@
1004  
1005      static char *kwd_list[] = { "domid", "bus", "dev", "func", "enable", NULL };
1006  
1007 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiii", kwd_list, 
1008 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiiii", kwd_list,
1009                                        &dom, &bus, &dev, &func, &enable) )
1010          return NULL;
1011  
1012 @@ -900,7 +900,7 @@
1013                              "nr_nodes",         pinfo.nr_nodes,
1014                              "threads_per_core", pinfo.threads_per_core,
1015                              "cores_per_socket", pinfo.cores_per_socket,
1016 -                            "nr_cpus",          pinfo.nr_cpus, 
1017 +                            "nr_cpus",          pinfo.nr_cpus,
1018                              "total_memory",     pages_to_kib(pinfo.total_pages),
1019                              "free_memory",      pages_to_kib(pinfo.free_pages),
1020                              "scrub_memory",     pages_to_kib(pinfo.scrub_pages),
1021 @@ -1190,13 +1190,13 @@
1022  
1023      static char *kwd_list[] = { "dom", "op", NULL };
1024  
1025 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list, 
1026 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
1027                                        &dom, &op) )
1028          return NULL;
1029 -    
1030 +
1031      if ( xc_shadow_control(xc->xc_handle, dom, op, NULL, 0) < 0 )
1032          return pyxc_error_to_exception(xc->xc_handle);
1033 -    
1034 +
1035      Py_INCREF(zero);
1036      return zero;
1037  }
1038 @@ -1213,26 +1213,26 @@
1039  
1040      static char *kwd_list[] = { "dom", "mb", NULL };
1041  
1042 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list, 
1043 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i|i", kwd_list,
1044                                        &dom, &mbarg) )
1045          return NULL;
1046 -    
1047 -    if ( mbarg < 0 ) 
1048 +
1049 +    if ( mbarg < 0 )
1050          op = XEN_DOMCTL_SHADOW_OP_GET_ALLOCATION;
1051 -    else 
1052 +    else
1053      {
1054          mb = mbarg;
1055          op = XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION;
1056      }
1057      if ( xc_shadow_control(xc->xc_handle, dom, op, &mb, 0) < 0 )
1058          return pyxc_error_to_exception(xc->xc_handle);
1059 -    
1060 +
1061      mbarg = mb;
1062      return Py_BuildValue("i", mbarg);
1063  }
1064  
1065  static PyObject *pyxc_sched_id_get(XcObject *self) {
1066 -    
1067 +
1068      int sched_id;
1069      if (xc_sched_id(self->xc_handle, &sched_id) != 0)
1070          return PyErr_SetFromErrno(xc_error_obj);
1071 @@ -1250,10 +1250,10 @@
1072      static char *kwd_list[] = { "domid", "weight", "cap", NULL };
1073      static char kwd_type[] = "I|HH";
1074      struct xen_domctl_sched_credit sdom;
1075 -    
1076 +
1077      weight = 0;
1078      cap = (uint16_t)~0U;
1079 -    if( !PyArg_ParseTupleAndKeywords(args, kwds, kwd_type, kwd_list, 
1080 +    if( !PyArg_ParseTupleAndKeywords(args, kwds, kwd_type, kwd_list,
1081                                       &domid, &weight, &cap) )
1082          return NULL;
1083  
1084 @@ -1271,10 +1271,10 @@
1085  {
1086      uint32_t domid;
1087      struct xen_domctl_sched_credit sdom;
1088 -    
1089 +
1090      if( !PyArg_ParseTuple(args, "I", &domid) )
1091          return NULL;
1092 -    
1093 +
1094      if ( xc_sched_credit_domain_get(self->xc_handle, domid, &sdom) != 0 )
1095          return pyxc_error_to_exception(self->xc_handle);
1096  
1097 @@ -1335,7 +1335,7 @@
1098  
1099      if (xc_domain_setmaxmem(self->xc_handle, dom, maxmem_kb) != 0)
1100          return pyxc_error_to_exception(self->xc_handle);
1101 -    
1102 +
1103      Py_INCREF(zero);
1104      return zero;
1105  }
1106 @@ -1348,12 +1348,12 @@
1107      if (!PyArg_ParseTuple(args, "ii", &dom, &mem_kb))
1108          return NULL;
1109  
1110 -    mem_pages = mem_kb / 4; 
1111 +    mem_pages = mem_kb / 4;
1112  
1113      if (xc_domain_set_pod_target(self->xc_handle, dom, mem_pages,
1114                                  NULL, NULL, NULL) != 0)
1115          return pyxc_error_to_exception(self->xc_handle);
1116 -    
1117 +
1118      Py_INCREF(zero);
1119      return zero;
1120  }
1121 @@ -1368,7 +1368,7 @@
1122  
1123      if ( xc_domain_set_memmap_limit(self->xc_handle, dom, maplimit_kb) != 0 )
1124          return pyxc_error_to_exception(self->xc_handle);
1125 -    
1126 +
1127      Py_INCREF(zero);
1128      return zero;
1129  }
1130 @@ -1382,7 +1382,7 @@
1131  
1132      static char *kwd_list[] = { "domid", "first_port", "nr_ports", "allow_access", NULL };
1133  
1134 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiii", kwd_list, 
1135 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iiii", kwd_list,
1136                                        &dom, &first_port, &nr_ports, &allow_access) )
1137          return NULL;
1138  
1139 @@ -1405,7 +1405,7 @@
1140  
1141      static char *kwd_list[] = { "domid", "pirq", "allow_access", NULL };
1142  
1143 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iii", kwd_list, 
1144 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "iii", kwd_list,
1145                                        &dom, &pirq, &allow_access) )
1146          return NULL;
1147  
1148 @@ -1428,7 +1428,7 @@
1149  
1150      static char *kwd_list[] = { "domid", "first_pfn", "nr_pfns", "allow_access", NULL };
1151  
1152 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "illi", kwd_list, 
1153 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "illi", kwd_list,
1154                                        &dom, &first_pfn, &nr_pfns, &allow_access) )
1155          return NULL;
1156  
1157 @@ -1479,7 +1479,7 @@
1158  
1159      static char *kwd_list[] = { "domid", "trigger", "vcpu", NULL };
1160  
1161 -    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii|i", kwd_list, 
1162 +    if ( !PyArg_ParseTupleAndKeywords(args, kwds, "ii|i", kwd_list,
1163                                        &dom, &trigger, &vcpu) )
1164          return NULL;
1165  
1166 @@ -1533,7 +1533,7 @@
1167  
1168      if (xc_memshr_control(self->xc_handle, dom, enable) != 0)
1169          return pyxc_error_to_exception(self->xc_handle);
1170 -    
1171 +
1172      Py_INCREF(zero);
1173      return zero;
1174  }
1175 @@ -1757,11 +1757,11 @@
1176      if (!xc_handle) {
1177          return PyErr_SetFromErrno(xc_error_obj);
1178      }
1179 -    
1180 +
1181      ret = xc_flask_sid_to_context(xc_handle, sid, ctx, ctx_len);
1182 -    
1183 +
1184      xc_interface_close(xc_handle);
1185 -    
1186 +
1187      if ( ret != 0 ) {
1188          errno = -ret;
1189          return PyErr_SetFromErrno(xc_error_obj);
1190 @@ -1778,7 +1778,7 @@
1191      int ret;
1192  
1193      static char *kwd_list[] = { "policy", NULL };
1194 -  
1195 +
1196      if( !PyArg_ParseTupleAndKeywords(args, kwds, "s#", kwd_list, &policy, &len) )
1197          return NULL;
1198  
1199 @@ -1808,11 +1808,11 @@
1200      if (!xc_handle) {
1201          return PyErr_SetFromErrno(xc_error_obj);
1202      }
1203 -    
1204 +
1205      ret = xc_flask_getenforce(xc_handle);
1206 -    
1207 +
1208      xc_interface_close(xc_handle);
1209 -    
1210 +
1211      if ( ret < 0 ) {
1212          errno = -ret;
1213          return PyErr_SetFromErrno(xc_error_obj);
1214 @@ -1838,11 +1838,11 @@
1215      if (!xc_handle) {
1216          return PyErr_SetFromErrno(xc_error_obj);
1217      }
1218 -    
1219 +
1220      ret = xc_flask_setenforce(xc_handle, mode);
1221 -    
1222 +
1223      xc_interface_close(xc_handle);
1224 -    
1225 +
1226      if ( ret != 0 ) {
1227          errno = -ret;
1228          return PyErr_SetFromErrno(xc_error_obj);
1229 @@ -1860,7 +1860,7 @@
1230      uint32_t req, allowed, decided, auditallow, auditdeny, seqno;
1231      int ret;
1232  
1233 -    static char *kwd_list[] = { "src_context", "tar_context", 
1234 +    static char *kwd_list[] = { "src_context", "tar_context",
1235                                  "tar_class", "req_permissions",
1236                                  "decided", "auditallow","auditdeny",
1237                                  "seqno", NULL };
1238 @@ -1874,10 +1874,10 @@
1239      if (!xc_handle) {
1240          return PyErr_SetFromErrno(xc_error_obj);
1241      }
1242 -    
1243 +
1244      ret = xc_flask_access(xc_handle, scon, tcon, tclass, req, &allowed, &decided,
1245                          &auditallow, &auditdeny, &seqno);
1246 -        
1247 +
1248      xc_interface_close(xc_handle);
1249  
1250      if ( ret != 0 ) {
1251 @@ -1889,14 +1889,14 @@
1252  }
1253  
1254  static PyMethodDef pyxc_methods[] = {
1255 -    { "domain_create", 
1256 -      (PyCFunction)pyxc_domain_create, 
1257 +    { "domain_create",
1258 +      (PyCFunction)pyxc_domain_create,
1259        METH_VARARGS | METH_KEYWORDS, "\n"
1260        "Create a new domain.\n"
1261        " dom    [int, 0]:        Domain identifier to use (allocated if zero).\n"
1262        "Returns: [int] new domain identifier; -1 on error.\n" },
1263  
1264 -    { "domain_max_vcpus", 
1265 +    { "domain_max_vcpus",
1266        (PyCFunction)pyxc_domain_max_vcpus,
1267        METH_VARARGS, "\n"
1268        "Set the maximum number of VCPUs a domain may create.\n"
1269 @@ -1904,43 +1904,43 @@
1270        " max     [int, 0]:      New maximum number of VCPUs in domain.\n"
1271        "Returns: [int] 0 on success; -1 on error.\n" },
1272  
1273 -    { "domain_dumpcore", 
1274 -      (PyCFunction)pyxc_domain_dumpcore, 
1275 +    { "domain_dumpcore",
1276 +      (PyCFunction)pyxc_domain_dumpcore,
1277        METH_VARARGS, "\n"
1278        "Dump core of a domain.\n"
1279        " dom [int]: Identifier of domain to dump core of.\n"
1280        " corefile [string]: Name of corefile to be created.\n\n"
1281        "Returns: [int] 0 on success; -1 on error.\n" },
1282  
1283 -    { "domain_pause", 
1284 -      (PyCFunction)pyxc_domain_pause, 
1285 +    { "domain_pause",
1286 +      (PyCFunction)pyxc_domain_pause,
1287        METH_VARARGS, "\n"
1288        "Temporarily pause execution of a domain.\n"
1289        " dom [int]: Identifier of domain to be paused.\n\n"
1290        "Returns: [int] 0 on success; -1 on error.\n" },
1291  
1292 -    { "domain_unpause", 
1293 -      (PyCFunction)pyxc_domain_unpause, 
1294 +    { "domain_unpause",
1295 +      (PyCFunction)pyxc_domain_unpause,
1296        METH_VARARGS, "\n"
1297        "(Re)start execution of a domain.\n"
1298        " dom [int]: Identifier of domain to be unpaused.\n\n"
1299        "Returns: [int] 0 on success; -1 on error.\n" },
1300  
1301 -    { "domain_destroy", 
1302 -      (PyCFunction)pyxc_domain_destroy, 
1303 +    { "domain_destroy",
1304 +      (PyCFunction)pyxc_domain_destroy,
1305        METH_VARARGS, "\n"
1306        "Destroy a domain.\n"
1307        " dom [int]:    Identifier of domain to be destroyed.\n\n"
1308        "Returns: [int] 0 on success; -1 on error.\n" },
1309  
1310 -    { "domain_destroy_hook", 
1311 -      (PyCFunction)pyxc_domain_destroy_hook, 
1312 +    { "domain_destroy_hook",
1313 +      (PyCFunction)pyxc_domain_destroy_hook,
1314        METH_VARARGS, "\n"
1315        "Add a hook for arch stuff before destroy a domain.\n"
1316        " dom [int]:    Identifier of domain to be destroyed.\n\n"
1317        "Returns: [int] 0 on success; -1 on error.\n" },
1318  
1319 -    { "domain_resume", 
1320 +    { "domain_resume",
1321        (PyCFunction)pyxc_domain_resume,
1322        METH_VARARGS, "\n"
1323        "Resume execution of a suspended domain.\n"
1324 @@ -1948,7 +1948,7 @@
1325        " fast [int]: Use cooperative resume.\n\n"
1326        "Returns: [int] 0 on success; -1 on error.\n" },
1327  
1328 -    { "domain_shutdown", 
1329 +    { "domain_shutdown",
1330        (PyCFunction)pyxc_domain_shutdown,
1331        METH_VARARGS, "\n"
1332        "Shutdown a domain.\n"
1333 @@ -1956,8 +1956,8 @@
1334        " reason     [int, 0]:      Reason for shutdown.\n"
1335        "Returns: [int] 0 on success; -1 on error.\n" },
1336  
1337 -    { "vcpu_setaffinity", 
1338 -      (PyCFunction)pyxc_vcpu_setaffinity, 
1339 +    { "vcpu_setaffinity",
1340 +      (PyCFunction)pyxc_vcpu_setaffinity,
1341        METH_VARARGS | METH_KEYWORDS, "\n"
1342        "Pin a VCPU to a specified set CPUs.\n"
1343        " dom [int]:     Identifier of domain to which VCPU belongs.\n"
1344 @@ -1965,7 +1965,7 @@
1345        " cpumap [list, []]: list of usable CPUs.\n\n"
1346        "Returns: [int] 0 on success; -1 on error.\n" },
1347  
1348 -    { "domain_sethandle", 
1349 +    { "domain_sethandle",
1350        (PyCFunction)pyxc_domain_sethandle,
1351        METH_VARARGS, "\n"
1352        "Set domain's opaque handle.\n"
1353 @@ -1973,8 +1973,8 @@
1354        " handle [list of 16 ints]: New opaque handle.\n"
1355        "Returns: [int] 0 on success; -1 on error.\n" },
1356  
1357 -    { "domain_getinfo", 
1358 -      (PyCFunction)pyxc_domain_getinfo, 
1359 +    { "domain_getinfo",
1360 +      (PyCFunction)pyxc_domain_getinfo,
1361        METH_VARARGS | METH_KEYWORDS, "\n"
1362        "Get information regarding a set of domains, in increasing id order.\n"
1363        " first_dom [int, 0]:    First domain to retrieve info about.\n"
1364 @@ -1999,8 +1999,8 @@
1365        "reason why it shut itself down.\n"
1366        " cpupool  [int]   Id of cpupool domain is bound to.\n" },
1367  
1368 -    { "vcpu_getinfo", 
1369 -      (PyCFunction)pyxc_vcpu_getinfo, 
1370 +    { "vcpu_getinfo",
1371 +      (PyCFunction)pyxc_vcpu_getinfo,
1372        METH_VARARGS | METH_KEYWORDS, "\n"
1373        "Get information regarding a VCPU.\n"
1374        " dom  [int]:    Domain to retrieve info about.\n"
1375 @@ -2024,7 +2024,7 @@
1376        " xenstore_domid [int]: \n"
1377        "Returns: None on success. Raises exception on error.\n" },
1378  
1379 -    { "hvm_get_param", 
1380 +    { "hvm_get_param",
1381        (PyCFunction)pyxc_hvm_param_get,
1382        METH_VARARGS | METH_KEYWORDS, "\n"
1383        "get a parameter of HVM guest OS.\n"
1384 @@ -2032,7 +2032,7 @@
1385        " param   [int]:      No. of HVM param.\n"
1386        "Returns: [long] value of the param.\n" },
1387  
1388 -    { "hvm_set_param", 
1389 +    { "hvm_set_param",
1390        (PyCFunction)pyxc_hvm_param_set,
1391        METH_VARARGS | METH_KEYWORDS, "\n"
1392        "set a parameter of HVM guest OS.\n"
1393 @@ -2075,12 +2075,12 @@
1394         " dom     [int]:      Domain to deassign device from.\n"
1395         " pci_str [str]:      PCI devices.\n"
1396         "Returns: [int] 0 on success, or device bdf that can't be deassigned.\n" },
1397 -  
1398 +
1399      { "sched_id_get",
1400        (PyCFunction)pyxc_sched_id_get,
1401        METH_NOARGS, "\n"
1402        "Get the current scheduler type in use.\n"
1403 -      "Returns: [int] sched_id.\n" },    
1404 +      "Returns: [int] sched_id.\n" },
1405  
1406      { "sched_credit_domain_set",
1407        (PyCFunction)pyxc_sched_credit_domain_set,
1408 @@ -2118,7 +2118,7 @@
1409        "Returns:   [dict]\n"
1410        " weight    [short]: domain's scheduling weight\n"},
1411  
1412 -    { "evtchn_alloc_unbound", 
1413 +    { "evtchn_alloc_unbound",
1414        (PyCFunction)pyxc_evtchn_alloc_unbound,
1415        METH_VARARGS | METH_KEYWORDS, "\n"
1416        "Allocate an unbound port that will await a remote connection.\n"
1417 @@ -2126,7 +2126,7 @@
1418        " remote_dom [int]: Remote domain to accept connections from.\n\n"
1419        "Returns: [int] Unbound event-channel port.\n" },
1420  
1421 -    { "evtchn_reset", 
1422 +    { "evtchn_reset",
1423        (PyCFunction)pyxc_evtchn_reset,
1424        METH_VARARGS | METH_KEYWORDS, "\n"
1425        "Reset all connections.\n"
1426 @@ -2151,9 +2151,9 @@
1427        " func   [int]: PCI function\n"
1428        " enable [int]: Non-zero means enable access; else disable access\n\n"
1429        "Returns: [int] 0 on success; -1 on error.\n" },
1430
1431 -    { "readconsolering", 
1432 -      (PyCFunction)pyxc_readconsolering, 
1433 +
1434 +    { "readconsolering",
1435 +      (PyCFunction)pyxc_readconsolering,
1436        METH_VARARGS | METH_KEYWORDS, "\n"
1437        "Read Xen's console ring.\n"
1438        " clear [int, 0]: Bool - clear the ring after reading from it?\n\n"
1439 @@ -2201,40 +2201,40 @@
1440        "Returns [str]: Xen buildid"
1441        "        [None]: on failure.\n" },
1442  
1443 -    { "shadow_control", 
1444 -      (PyCFunction)pyxc_shadow_control, 
1445 +    { "shadow_control",
1446 +      (PyCFunction)pyxc_shadow_control,
1447        METH_VARARGS | METH_KEYWORDS, "\n"
1448        "Set parameter for shadow pagetable interface\n"
1449        " dom [int]:   Identifier of domain.\n"
1450        " op [int, 0]: operation\n\n"
1451        "Returns: [int] 0 on success; -1 on error.\n" },
1452  
1453 -    { "shadow_mem_control", 
1454 -      (PyCFunction)pyxc_shadow_mem_control, 
1455 +    { "shadow_mem_control",
1456 +      (PyCFunction)pyxc_shadow_mem_control,
1457        METH_VARARGS | METH_KEYWORDS, "\n"
1458        "Set or read shadow pagetable memory use\n"
1459        " dom [int]:   Identifier of domain.\n"
1460        " mb [int, -1]: MB of shadow memory this domain should have.\n\n"
1461        "Returns: [int] MB of shadow memory in use by this domain.\n" },
1462  
1463 -    { "domain_setmaxmem", 
1464 -      (PyCFunction)pyxc_domain_setmaxmem, 
1465 +    { "domain_setmaxmem",
1466 +      (PyCFunction)pyxc_domain_setmaxmem,
1467        METH_VARARGS, "\n"
1468        "Set a domain's memory limit\n"
1469        " dom [int]: Identifier of domain.\n"
1470        " maxmem_kb [int]: .\n"
1471        "Returns: [int] 0 on success; -1 on error.\n" },
1472  
1473 -    { "domain_set_target_mem", 
1474 -      (PyCFunction)pyxc_domain_set_target_mem, 
1475 +    { "domain_set_target_mem",
1476 +      (PyCFunction)pyxc_domain_set_target_mem,
1477        METH_VARARGS, "\n"
1478        "Set a domain's memory target\n"
1479        " dom [int]: Identifier of domain.\n"
1480        " mem_kb [int]: .\n"
1481        "Returns: [int] 0 on success; -1 on error.\n" },
1482  
1483 -    { "domain_set_memmap_limit", 
1484 -      (PyCFunction)pyxc_domain_set_memmap_limit, 
1485 +    { "domain_set_memmap_limit",
1486 +      (PyCFunction)pyxc_domain_set_memmap_limit,
1487        METH_VARARGS, "\n"
1488        "Set a domain's physical memory mapping limit\n"
1489        " dom [int]: Identifier of domain.\n"
1490 @@ -2308,7 +2308,7 @@
1491        "Inject debug keys into Xen.\n"
1492        " keys    [str]: String of keys to inject.\n" },
1493  
1494 -    { "dom_set_memshr", 
1495 +    { "dom_set_memshr",
1496        (PyCFunction)pyxc_dom_set_memshr,
1497        METH_VARARGS, "\n"
1498        "Enable/disable memory sharing for the domain.\n"
1499 @@ -2390,20 +2390,20 @@
1500        METH_VARARGS | METH_KEYWORDS, "\n"
1501        "Loads a policy into the hypervisor.\n"
1502        " policy [str]: policy to be load\n"
1503 -      "Returns: [int]: 0 on success; -1 on failure.\n" }, 
1504 -      
1505 +      "Returns: [int]: 0 on success; -1 on failure.\n" },
1506 +
1507      { "flask_getenforce",
1508        (PyCFunction)pyflask_getenforce,
1509        METH_NOARGS, "\n"
1510        "Returns the current mode of the Flask XSM module.\n"
1511 -      "Returns: [int]: 0 for permissive; 1 for enforcing; -1 on failure.\n" }, 
1512 +      "Returns: [int]: 0 for permissive; 1 for enforcing; -1 on failure.\n" },
1513  
1514      { "flask_setenforce",
1515        (PyCFunction)pyflask_setenforce,
1516        METH_VARARGS | METH_KEYWORDS, "\n"
1517        "Modifies the current mode for the Flask XSM module.\n"
1518        " mode [int]: mode to change to\n"
1519 -      "Returns: [int]: 0 on success; -1 on failure.\n" }, 
1520 +      "Returns: [int]: 0 on success; -1 on failure.\n" },
1521  
1522      { "flask_access",
1523        (PyCFunction)pyflask_access,
1524 @@ -2422,7 +2422,7 @@
1525        " auditdeny [int] permissions set to audit on deny\n"
1526        " seqno [int] not used\n"
1527        "Returns: [int]: 0 on all permission granted; -1 if any permissions are \
1528 -       denied\n" }, 
1529 +       denied\n" },
1530  
1531      { NULL, NULL, 0, NULL }
1532  };
1533 diff -urN xen-4.16.2.orig/tools/python/xen/lowlevel/xs/xs.c xen-4.16.2/tools/python/xen/lowlevel/xs/xs.c
1534 --- xen-4.16.2.orig/tools/python/xen/lowlevel/xs/xs.c   2022-08-18 13:47:46.000000000 +0200
1535 +++ xen-4.16.2/tools/python/xen/lowlevel/xs/xs.c        2023-07-23 20:27:33.484877729 +0200
1536 @@ -1,4 +1,4 @@
1537 -/* 
1538 +/*
1539   * Python interface to the Xen Store Daemon.
1540   *
1541   * This library is free software; you can redistribute it and/or
1542 @@ -858,7 +858,7 @@
1543   * Parse transaction and path arguments from the given args and kwds,
1544   * convert the given self value to an xs_handle, and return all three by
1545   * reference.
1546 - * 
1547 + *
1548   * @return 1 on success, in which case *xh, *th, and *path are valid, or 0 on
1549   * failure.
1550   */
1551 diff -urN xen-4.16.2.orig/tools/python/xen/migration/legacy.py xen-4.16.2/tools/python/xen/migration/legacy.py
1552 --- xen-4.16.2.orig/tools/python/xen/migration/legacy.py        2022-08-18 13:47:46.000000000 +0200
1553 +++ xen-4.16.2/tools/python/xen/migration/legacy.py     2023-07-23 20:27:33.484877729 +0200
1554 @@ -1,4 +1,3 @@
1555 -#!/usr/bin/env python
1556  # -*- coding: utf-8 -*-
1557  
1558  """
1559 diff -urN xen-4.16.2.orig/tools/python/xen/migration/libxc.py xen-4.16.2/tools/python/xen/migration/libxc.py
1560 --- xen-4.16.2.orig/tools/python/xen/migration/libxc.py 2022-08-18 13:47:46.000000000 +0200
1561 +++ xen-4.16.2/tools/python/xen/migration/libxc.py      2023-07-23 20:27:33.485877743 +0200
1562 @@ -1,4 +1,3 @@
1563 -#!/usr/bin/env python
1564  # -*- coding: utf-8 -*-
1565  
1566  """
1567 diff -urN xen-4.16.2.orig/tools/python/xen/migration/libxl.py xen-4.16.2/tools/python/xen/migration/libxl.py
1568 --- xen-4.16.2.orig/tools/python/xen/migration/libxl.py 2022-08-18 13:47:46.000000000 +0200
1569 +++ xen-4.16.2/tools/python/xen/migration/libxl.py      2023-07-23 20:27:33.485877743 +0200
1570 @@ -1,4 +1,3 @@
1571 -#!/usr/bin/env python
1572  # -*- coding: utf-8 -*-
1573  
1574  """
1575 diff -urN xen-4.16.2.orig/tools/python/xen/migration/public.py xen-4.16.2/tools/python/xen/migration/public.py
1576 --- xen-4.16.2.orig/tools/python/xen/migration/public.py        2022-08-18 13:47:46.000000000 +0200
1577 +++ xen-4.16.2/tools/python/xen/migration/public.py     2023-07-23 20:27:33.485877743 +0200
1578 @@ -1,4 +1,3 @@
1579 -#!/usr/bin/env python
1580  # -*- coding: utf-8 -*-
1581  
1582  """
1583 diff -urN xen-4.16.2.orig/tools/python/xen/migration/tests.py xen-4.16.2/tools/python/xen/migration/tests.py
1584 --- xen-4.16.2.orig/tools/python/xen/migration/tests.py 2022-08-18 13:47:46.000000000 +0200
1585 +++ xen-4.16.2/tools/python/xen/migration/tests.py      2023-07-23 20:27:33.485877743 +0200
1586 @@ -1,4 +1,3 @@
1587 -#!/usr/bin/env python
1588  # -*- coding: utf-8 -*-
1589  
1590  """
1591 @@ -26,6 +25,8 @@
1592                           (libxc.X86_TSC_INFO_FORMAT, 24),
1593                           (libxc.HVM_PARAMS_ENTRY_FORMAT, 16),
1594                           (libxc.HVM_PARAMS_FORMAT, 8),
1595 +                         (libxc.X86_CPUID_POLICY_FORMAT, 24),
1596 +                         (libxc.X86_MSR_POLICY_FORMAT, 16),
1597                           ):
1598              self.assertEqual(calcsize(fmt), sz)
1599  
1600 @@ -40,15 +41,3 @@
1601                           (libxl.EMULATOR_HEADER_FORMAT, 8),
1602                           ):
1603              self.assertEqual(calcsize(fmt), sz)
1604 -
1605 -
1606 -def test_suite():
1607 -    suite = unittest.TestSuite()
1608 -
1609 -    suite.addTest(unittest.makeSuite(TestLibxc))
1610 -    suite.addTest(unittest.makeSuite(TestLibxl))
1611 -
1612 -    return suite
1613 -
1614 -if __name__ == "__main__":
1615 -    unittest.main()
1616 diff -urN xen-4.16.2.orig/tools/python/xen/migration/verify.py xen-4.16.2/tools/python/xen/migration/verify.py
1617 --- xen-4.16.2.orig/tools/python/xen/migration/verify.py        2022-08-18 13:47:46.000000000 +0200
1618 +++ xen-4.16.2/tools/python/xen/migration/verify.py     2023-07-23 20:27:33.485877743 +0200
1619 @@ -1,4 +1,3 @@
1620 -#!/usr/bin/env python
1621  # -*- coding: utf-8 -*-
1622  
1623  """
1624 diff -urN xen-4.16.2.orig/tools/python/xen/migration/xl.py xen-4.16.2/tools/python/xen/migration/xl.py
1625 --- xen-4.16.2.orig/tools/python/xen/migration/xl.py    2022-08-18 13:47:46.000000000 +0200
1626 +++ xen-4.16.2/tools/python/xen/migration/xl.py 2023-07-23 20:27:33.485877743 +0200
1627 @@ -1,4 +1,3 @@
1628 -#!/usr/bin/env python
1629  # -*- coding: utf-8 -*-
1630  
1631  """
1632 diff -urN xen-4.16.2.orig/tools/python/xen/util.py xen-4.16.2/tools/python/xen/util.py
1633 --- xen-4.16.2.orig/tools/python/xen/util.py    2022-08-18 13:47:46.000000000 +0200
1634 +++ xen-4.16.2/tools/python/xen/util.py 2023-07-23 20:27:33.486877758 +0200
1635 @@ -1,4 +1,3 @@
1636 -#!/usr/bin/env python
1637  # -*- coding: utf-8 -*-
1638  
1639  import os
1640 diff -urN xen-4.16.2.orig/tools/Rules.mk xen-4.16.2/tools/Rules.mk
1641 --- xen-4.16.2.orig/tools/Rules.mk      2022-08-18 13:47:46.000000000 +0200
1642 +++ xen-4.16.2/tools/Rules.mk   2023-07-23 20:27:33.514878153 +0200
1643 @@ -141,7 +141,7 @@
1644  CFLAGS += $(EXTRA_CFLAGS_XEN_TOOLS)
1645  
1646  INSTALL_PYTHON_PROG = \
1647 -       $(XEN_ROOT)/tools/python/install-wrap "$(PYTHON_PATH)" $(INSTALL_PROG)
1648 +       $(XEN_ROOT)/tools/python/install-wrap "$(PYTHON_PATH) -s" $(INSTALL_PROG)
1649  
1650  %.opic: %.c
1651         $(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS_$*.opic) -fPIC -c -o $@ $< $(APPEND_CFLAGS)
1652 diff -urN xen-4.16.2.orig/tools/xenmon/xenmon.py xen-4.16.2/tools/xenmon/xenmon.py
1653 --- xen-4.16.2.orig/tools/xenmon/xenmon.py      2022-08-18 13:47:46.000000000 +0200
1654 +++ xen-4.16.2/tools/xenmon/xenmon.py   2023-07-23 20:27:33.514878153 +0200
1655 @@ -13,12 +13,12 @@
1656  #   This program is free software; you can redistribute it and/or modify
1657  #   it under the terms of the GNU General Public License as published by
1658  #   the Free Software Foundation; under version 2 of the License.
1659 -# 
1660 +#
1661  #   This program is distributed in the hope that it will be useful,
1662  #   but WITHOUT ANY WARRANTY; without even the implied warranty of
1663  #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1664  #   GNU General Public License for more details.
1665 -# 
1666 +#
1667  #   You should have received a copy of the GNU General Public License
1668  #   along with this program; If not, see <http://www.gnu.org/licenses/>.
1669  #####################################################################
1670 @@ -79,7 +79,7 @@
1671      parser.add_option("-p", "--prefix", dest="prefix",
1672                        default = "log", help="prefix to use for output files")
1673      parser.add_option("-t", "--time", dest="duration",
1674 -            action="store", type="int", default=10, 
1675 +            action="store", type="int", default=10,
1676              help="stop logging to file after this much time has elapsed (in seconds). set to 0 to keep logging indefinitely")
1677      parser.add_option("-i", "--interval", dest="interval",
1678              action="store", type="int", default=1000,
1679 @@ -179,7 +179,7 @@
1680          return [total/(float(passed)/10**9), avg]
1681  
1682      def stats(self, passed):
1683 -        return [self.gotten_stats(passed), self.allocated_stats(passed), self.blocked_stats(passed), 
1684 +        return [self.gotten_stats(passed), self.allocated_stats(passed), self.blocked_stats(passed),
1685                  self.waited_stats(passed), self.ec_stats(passed), self.io_stats(passed)]
1686  
1687  # report values over desired interval
1688 @@ -187,13 +187,13 @@
1689      dominfos = {}
1690      for i in range(0, NDOMAINS):
1691          dominfos[i] = DomainInfo()
1692 -        
1693 +
1694      passed = 1              # to prevent zero division
1695      curid = startat
1696      numbuckets = 0
1697      lost_samples = []
1698      ffp_samples = []
1699 -    
1700 +
1701      while passed < duration:
1702          for i in range(0, NDOMAINS):
1703              if dom_in_use[i]:
1704 @@ -203,7 +203,7 @@
1705                  dominfos[i].blocked_sum += samples[curid][3*NDOMAINS + i]
1706                  dominfos[i].exec_count += samples[curid][4*NDOMAINS + i]
1707                  dominfos[i].iocount_sum += samples[curid][5*NDOMAINS + i]
1708 -    
1709 +
1710          passed += samples[curid][6*NDOMAINS]
1711          lost_samples.append(samples[curid][6*NDOMAINS + 2])
1712          ffp_samples.append(samples[curid][6*NDOMAINS + 3])
1713 @@ -271,7 +271,7 @@
1714      cpu_10sec_usage = 0.0
1715      heartbeat = 1
1716      global dom_in_use, options
1717 -    
1718 +
1719      # mmap the (the first chunk of the) file
1720      shmf = open(SHM_FILE, "r+")
1721      shm = mmap.mmap(shmf.fileno(), QOS_DATA_SIZE)
1722 @@ -284,7 +284,7 @@
1723      stdscr.keypad(1)
1724      stdscr.timeout(1000)
1725      [maxy, maxx] = stdscr.getmaxyx()
1726 -    
1727 +
1728      # display in a loop
1729      while True:
1730  
1731 @@ -342,7 +342,7 @@
1732              cpuidx = cpuidx + 1
1733  
1734          # calculate starting and ending datapoints; never look at "next" since
1735 -        # it represents live data that may be in transition. 
1736 +        # it represents live data that may be in transition.
1737          startat = next - 1
1738          if next + 10 < NSAMPLES:
1739              endat = next + 10
1740 @@ -374,7 +374,7 @@
1741  
1742              if h1[dom][0][1] > 0 or domain_id[dom] == IDLE_DOMAIN:
1743                  # display gotten
1744 -                row += 1 
1745 +                row += 1
1746                  col = 2
1747                  display_domain_id(stdscr, row, col, domain_id[dom])
1748                  col += 4
1749 @@ -396,7 +396,7 @@
1750  
1751                  if dom != IDLE_DOMAIN:
1752                      cpu_1sec_usage = cpu_1sec_usage + h1[dom][0][1]
1753 -    
1754 +
1755                  # display allocated
1756                  if options.allocated:
1757                      row += 1
1758 @@ -454,7 +454,7 @@
1759                      row += 1
1760                      col = 2
1761                      display_domain_id(stdscr, row, col, domain_id[dom])
1762 -                    
1763 +
1764                      col += 28
1765                      display(stdscr, row, col, "%d/s" % h2[dom][4])
1766                      col += 42
1767 @@ -490,14 +490,14 @@
1768          display(stdscr, row, 1, star)
1769          display(stdscr, row, 2, TOTALS % (total_h2_cpu, total_h1_cpu))
1770          row += 1
1771 -#        display(stdscr, row, 2, 
1772 -#                "\tFFP: %d (Min: %d, Max: %d)\t\t\tFFP: %d (Min: %d, Max %d)" % 
1773 +#        display(stdscr, row, 2,
1774 +#                "\tFFP: %d (Min: %d, Max: %d)\t\t\tFFP: %d (Min: %d, Max %d)" %
1775  #                (math.ceil(f2[1]), f2[0], f2[2], math.ceil(f1[1]), f1[0], f1[2]), _c.A_BOLD)
1776  
1777          if l1[1] > 1 :
1778              row += 1
1779 -            display(stdscr, row, 2, 
1780 -                    "\tRecords lost: %d (Min: %d, Max: %d)\t\t\tRecords lost: %d (Min: %d, Max %d)" % 
1781 +            display(stdscr, row, 2,
1782 +                    "\tRecords lost: %d (Min: %d, Max: %d)\t\t\tRecords lost: %d (Min: %d, Max %d)" %
1783                      (math.ceil(l2[1]), l2[0], l2[2], math.ceil(l1[1]), l1[0], l1[2]), _c.A_BOLD)
1784  
1785          # grab a char from tty input; exit if interrupt hit
1786 @@ -505,11 +505,11 @@
1787              c = stdscr.getch()
1788          except:
1789              break
1790 -        
1791 +
1792          # q = quit
1793          if c == ord('q'):
1794              break
1795 -    
1796 +
1797          # c = cycle to a new cpu of interest
1798          if c == ord('c'):
1799              cpu = (cpu + 1) % ncpu
1800 @@ -560,7 +560,7 @@
1801      def close(self):
1802          if  self.opened:
1803              self.file.close()
1804 -            
1805 +
1806  
1807  def writelog():
1808      global options
1809 @@ -639,7 +639,7 @@
1810                                       h1[dom][1],
1811                                       h1[dom][2][0], h1[dom][2][1], h1[dom][2][2],
1812                                       h1[dom][3][0], h1[dom][3][1], h1[dom][3][2],
1813 -                                     h1[dom][4], 
1814 +                                     h1[dom][4],
1815                                       h1[dom][5][0], h1[dom][5][1]))
1816                      outfiles[dom].flush()
1817              curr = time.time()
1818 @@ -698,7 +698,7 @@
1819         options.mspersample > options.duration * 1000:
1820          parser.error("option --ms_per_sample: too large (> %d ms)" %
1821                       (options.duration * 1000))
1822 -    
1823 +
1824      start_xenbaked()
1825      if options.live:
1826          show_livestats(options.cpu)
This page took 0.255104 seconds and 4 git commands to generate.