~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/hv/lsvmbus

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /tools/hv/lsvmbus (Version linux-6.12-rc7) and /tools/hv/lsvmbus (Version linux-4.9.337)


  1 #!/usr/bin/env python3                         !!   1 #!/usr/bin/env python
  2 # SPDX-License-Identifier: GPL-2.0             << 
  3                                                     2 
  4 import os                                           3 import os
  5 from optparse import OptionParser                   4 from optparse import OptionParser
  6                                                     5 
  7 help_msg = "print verbose messages. Try -vv, - << 
  8 parser = OptionParser()                             6 parser = OptionParser()
  9 parser.add_option(                             !!   7 parser.add_option("-v", "--verbose", dest="verbose",
 10         "-v", "--verbose", dest="verbose", hel !!   8                    help="print verbose messages. Try -vv, -vvv for \
                                                   >>   9                         more verbose messages", action="count")
 11                                                    10 
 12 (options, args) = parser.parse_args()              11 (options, args) = parser.parse_args()
 13                                                    12 
 14 verbose = 0                                        13 verbose = 0
 15 if options.verbose is not None:                    14 if options.verbose is not None:
 16         verbose = options.verbose                  15         verbose = options.verbose
 17                                                    16 
 18 vmbus_sys_path = '/sys/bus/vmbus/devices'          17 vmbus_sys_path = '/sys/bus/vmbus/devices'
 19 if not os.path.isdir(vmbus_sys_path):              18 if not os.path.isdir(vmbus_sys_path):
 20         print("%s doesn't exist: exiting..." % !!  19         print "%s doesn't exist: exiting..." % vmbus_sys_path
 21         exit(-1)                                   20         exit(-1)
 22                                                    21 
 23 vmbus_dev_dict = {                                 22 vmbus_dev_dict = {
 24         '{0e0b6031-5213-4934-818b-38d90ced39db !!  23         '{0e0b6031-5213-4934-818b-38d90ced39db}' : '[Operating system shutdown]',
 25         '{9527e630-d0ae-497b-adce-e80ab0175caf !!  24         '{9527e630-d0ae-497b-adce-e80ab0175caf}' : '[Time Synchronization]',
 26         '{57164f39-9115-4e78-ab55-382f3bd5422d !!  25         '{57164f39-9115-4e78-ab55-382f3bd5422d}' : '[Heartbeat]',
 27         '{a9a0f4e7-5a45-4d96-b827-8a841e8c03e6 !!  26         '{a9a0f4e7-5a45-4d96-b827-8a841e8c03e6}' : '[Data Exchange]',
 28         '{35fa2e29-ea23-4236-96ae-3a6ebacba440 !!  27         '{35fa2e29-ea23-4236-96ae-3a6ebacba440}' : '[Backup (volume checkpoint)]',
 29         '{34d14be3-dee4-41c8-9ae7-6b174977c192 !!  28         '{34d14be3-dee4-41c8-9ae7-6b174977c192}' : '[Guest services]',
 30         '{525074dc-8985-46e2-8057-a307dc18a502 !!  29         '{525074dc-8985-46e2-8057-a307dc18a502}' : '[Dynamic Memory]',
 31         '{cfa8b69e-5b4a-4cc0-b98b-8ba1a1f3f95a !!  30         '{cfa8b69e-5b4a-4cc0-b98b-8ba1a1f3f95a}' : 'Synthetic mouse',
 32         '{f912ad6d-2b17-48ea-bd65-f927a61c7684 !!  31         '{f912ad6d-2b17-48ea-bd65-f927a61c7684}' : 'Synthetic keyboard',
 33         '{da0a7802-e377-4aac-8e77-0558eb1073f8 !!  32         '{da0a7802-e377-4aac-8e77-0558eb1073f8}' : 'Synthetic framebuffer adapter',
 34         '{f8615163-df3e-46c5-913f-f2d2f965ed0e !!  33         '{f8615163-df3e-46c5-913f-f2d2f965ed0e}' : 'Synthetic network adapter',
 35         '{32412632-86cb-44a2-9b5c-50d1417354f5 !!  34         '{32412632-86cb-44a2-9b5c-50d1417354f5}' : 'Synthetic IDE Controller',
 36         '{ba6163d9-04a1-4d29-b605-72e2ffb1dc7f !!  35         '{ba6163d9-04a1-4d29-b605-72e2ffb1dc7f}' : 'Synthetic SCSI Controller',
 37         '{2f9bcc4a-0069-4af3-b76b-6fd0be528cda !!  36         '{2f9bcc4a-0069-4af3-b76b-6fd0be528cda}' : 'Synthetic fiber channel adapter',
 38         '{8c2eaf3d-32a7-4b09-ab99-bd1f1c86b501 !!  37         '{8c2eaf3d-32a7-4b09-ab99-bd1f1c86b501}' : 'Synthetic RDMA adapter',
 39         '{44c4f61d-4444-4400-9d52-802e27ede19f !!  38         '{44c4f61d-4444-4400-9d52-802e27ede19f}' : 'PCI Express pass-through',
 40         '{276aacf4-ac15-426c-98dd-7521ad3f01fe !!  39         '{276aacf4-ac15-426c-98dd-7521ad3f01fe}' : '[Reserved system device]',
 41         '{f8e65716-3cb3-4a06-9a60-1889c5cccab5 !!  40         '{f8e65716-3cb3-4a06-9a60-1889c5cccab5}' : '[Reserved system device]',
 42         '{3375baf4-9e15-4b30-b765-67acb10d607b !!  41         '{3375baf4-9e15-4b30-b765-67acb10d607b}' : '[Reserved system device]',
 43 }                                                  42 }
 44                                                    43 
 45                                                << 
 46 def get_vmbus_dev_attr(dev_name, attr):            44 def get_vmbus_dev_attr(dev_name, attr):
 47         try:                                       45         try:
 48                 f = open('%s/%s/%s' % (vmbus_s     46                 f = open('%s/%s/%s' % (vmbus_sys_path, dev_name, attr), 'r')
 49                 lines = f.readlines()              47                 lines = f.readlines()
 50                 f.close()                          48                 f.close()
 51         except IOError:                            49         except IOError:
 52                 lines = []                         50                 lines = []
 53                                                    51 
 54         return lines                               52         return lines
 55                                                    53 
 56                                                << 
 57 class VMBus_Dev:                                   54 class VMBus_Dev:
 58         pass                                       55         pass
 59                                                    56 
 60                                                    57 
 61 vmbus_dev_list = []                                58 vmbus_dev_list = []
 62                                                    59 
 63 for f in os.listdir(vmbus_sys_path):               60 for f in os.listdir(vmbus_sys_path):
 64         vmbus_id = get_vmbus_dev_attr(f, 'id')     61         vmbus_id = get_vmbus_dev_attr(f, 'id')[0].strip()
 65         class_id = get_vmbus_dev_attr(f, 'clas     62         class_id = get_vmbus_dev_attr(f, 'class_id')[0].strip()
 66         device_id = get_vmbus_dev_attr(f, 'dev     63         device_id = get_vmbus_dev_attr(f, 'device_id')[0].strip()
 67         dev_desc = vmbus_dev_dict.get(class_id     64         dev_desc = vmbus_dev_dict.get(class_id, 'Unknown')
 68                                                    65 
 69         chn_vp_mapping = get_vmbus_dev_attr(f,     66         chn_vp_mapping = get_vmbus_dev_attr(f, 'channel_vp_mapping')
 70         chn_vp_mapping = [c.strip() for c in c     67         chn_vp_mapping = [c.strip() for c in chn_vp_mapping]
 71         chn_vp_mapping = sorted(               !!  68         chn_vp_mapping = sorted(chn_vp_mapping,
 72                 chn_vp_mapping, key=lambda c:  !!  69                 key = lambda c : int(c.split(':')[0]))
 73                                                    70 
 74         chn_vp_mapping = [                     !!  71         chn_vp_mapping = ['\tRel_ID=%s, target_cpu=%s' %
 75                 '\tRel_ID=%s, target_cpu=%s' % !!  72                                 (c.split(':')[0], c.split(':')[1])
 76                 (c.split(':')[0], c.split(':') !!  73                                         for c in chn_vp_mapping]
 77         ]                                      << 
 78         d = VMBus_Dev()                            74         d = VMBus_Dev()
 79         d.sysfs_path = '%s/%s' % (vmbus_sys_pa     75         d.sysfs_path = '%s/%s' % (vmbus_sys_path, f)
 80         d.vmbus_id = vmbus_id                      76         d.vmbus_id = vmbus_id
 81         d.class_id = class_id                      77         d.class_id = class_id
 82         d.device_id = device_id                    78         d.device_id = device_id
 83         d.dev_desc = dev_desc                      79         d.dev_desc = dev_desc
 84         d.chn_vp_mapping = '\n'.join(chn_vp_ma     80         d.chn_vp_mapping = '\n'.join(chn_vp_mapping)
 85         if d.chn_vp_mapping:                       81         if d.chn_vp_mapping:
 86                 d.chn_vp_mapping += '\n'           82                 d.chn_vp_mapping += '\n'
 87                                                    83 
 88         vmbus_dev_list.append(d)                   84         vmbus_dev_list.append(d)
 89                                                    85 
 90                                                    86 
 91 vmbus_dev_list = sorted(vmbus_dev_list, key=la !!  87 vmbus_dev_list  = sorted(vmbus_dev_list, key = lambda d : int(d.vmbus_id))
 92                                                    88 
 93 format0 = '%2s: %s'                                89 format0 = '%2s: %s'
 94 format1 = '%2s: Class_ID = %s - %s\n%s'            90 format1 = '%2s: Class_ID = %s - %s\n%s'
 95 format2 = '%2s: Class_ID = %s - %s\n\tDevice_I     91 format2 = '%2s: Class_ID = %s - %s\n\tDevice_ID = %s\n\tSysfs path: %s\n%s'
 96                                                    92 
 97 for d in vmbus_dev_list:                           93 for d in vmbus_dev_list:
 98         if verbose == 0:                           94         if verbose == 0:
 99                 print(('VMBUS ID ' + format0)  !!  95                 print ('VMBUS ID ' + format0) % (d.vmbus_id, d.dev_desc)
100         elif verbose == 1:                         96         elif verbose == 1:
101                 print(                         !!  97                 print ('VMBUS ID ' + format1) % \
102                         ('VMBUS ID ' + format1 << 
103                         (d.vmbus_id, d.class_i     98                         (d.vmbus_id, d.class_id, d.dev_desc, d.chn_vp_mapping)
104                 )                              << 
105         else:                                      99         else:
106                 print(                         !! 100                 print ('VMBUS ID ' + format2) % \
107                         ('VMBUS ID ' + format2 !! 101                         (d.vmbus_id, d.class_id, d.dev_desc, \
108                         (                      !! 102                         d.device_id, d.sysfs_path, d.chn_vp_mapping)
109                                 d.vmbus_id, d. << 
110                                 d.device_id, d << 
111                         )                      << 
112                 )                              << 
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php