All of lore.kernel.org
 help / color / mirror / Atom feed
From: OpenBMC Patches <openbmc-patches@stwcx.xyz>
To: openbmc@lists.ozlabs.org
Cc: Brad Bishop <bradleyb@us.ibm.com>
Subject: [PATCH phosphor-objmgr 5/6] Minor refactoring
Date: Wed, 13 Apr 2016 15:50:44 -0500	[thread overview]
Message-ID: <1460580645-5232-6-git-send-email-openbmc-patches@stwcx.xyz> (raw)
In-Reply-To: <1460580645-5232-1-git-send-email-openbmc-patches@stwcx.xyz>

From: Brad Bishop <bradleyb@us.ibm.com>

No functional changes.
Changed any bus name references to "owner".
A couple whitespace changes.
---
 phosphor-mapper | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/phosphor-mapper b/phosphor-mapper
index bf0e832..a00beaa 100644
--- a/phosphor-mapper
+++ b/phosphor-mapper
@@ -33,7 +33,7 @@ class MapperNotFoundException(dbus.exceptions.DBusException):
 
     def __init__(self, path):
         super(MapperNotFoundException, self).__init__(
-            "path or object not found: %s" % (path))
+            "path or object not found: %s" % path)
 
 
 class ObjectMapper(dbus.service.Object):
@@ -66,10 +66,10 @@ class ObjectMapper(dbus.service.Object):
             signal_name='InterfacesRemoved',
             sender_keyword='sender')
 
-    def bus_match(self, name):
-        if name == obmc.mapper.MAPPER_NAME:
-            return False
-        return self.name_match(name)
+    def bus_match(self, owner):
+        # Ignore my own signals
+        return owner != obmc.mapper.MAPPER_NAME and \
+            self.name_match(owner)
 
     def discovery_pending(self):
         return not bool(self.service)
@@ -92,19 +92,19 @@ class ObjectMapper(dbus.service.Object):
         new = list(set(old).difference(interfaces))
         self.update_interfaces(path, owner, old, new)
 
-    def process_new_owner(self, name):
+    def process_new_owner(self, owner):
         # unique name
-        return self.discover([IntrospectionParser(name,
+        return self.discover([IntrospectionParser(owner,
                              self.bus.dbus,
                              self.tag_match,
                              self.intf_match)])
 
-    def process_old_owner(self, name):
+    def process_old_owner(self, owner):
         for path, item in self.cache.dataitems():
-            old = self.interfaces_get(item, name)
+            old = self.interfaces_get(item, owner)
             # remove all interfaces for this service
             self.update_interfaces(
-                path, name, old=old, new=[])
+                path, owner, old=old, new=[])
 
     def bus_handler(self, owner, old, new):
         valid = False
@@ -129,12 +129,14 @@ class ObjectMapper(dbus.service.Object):
             interfaces = [str(i) for i in items.get('interfaces', [])]
             self.update_interfaces(path, str(owner), old=[], new=interfaces)
 
-    def discover(self, owners=None):
+    def discover(self, owners=[]):
         if not owners:
-            owners = [IntrospectionParser(x, self.bus.dbus,
-                                          self.tag_match,
-                                          self.intf_match)
-                      for x in self.bus.get_owner_names(self.bus_match)]
+            owners = [
+                IntrospectionParser(
+                    x, self.bus.dbus,
+                    self.tag_match,
+                    self.intf_match)
+                for x in self.bus.get_owner_names(self.bus_match)]
         for o in owners:
             self.add_items(o.name, o.introspect())
 
-- 
2.7.1

  parent reply	other threads:[~2016-04-13 20:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13 20:50 [PATCH phosphor-objmgr 0/6] association support OpenBMC Patches
2016-04-13 20:50 ` [PATCH phosphor-objmgr 1/6] Add gitignore OpenBMC Patches
2016-04-13 20:50 ` [PATCH phosphor-objmgr 2/6] Use pyobmc package OpenBMC Patches
2016-04-13 20:50 ` [PATCH phosphor-objmgr 3/6] Update license year from 2015 to 2016 OpenBMC Patches
2016-04-13 20:50 ` [PATCH phosphor-objmgr 4/6] Add cache access and signal validation wrappers OpenBMC Patches
2016-04-13 20:50 ` OpenBMC Patches [this message]
2016-04-13 20:50 ` [PATCH phosphor-objmgr 6/6] Add support for associations OpenBMC Patches
  -- strict thread matches above, loose matches on Subject: below --
2016-03-18 17:30 [PATCH phosphor-objmgr 0/6] association support OpenBMC Patches
2016-03-18 17:30 ` [PATCH phosphor-objmgr 5/6] Minor refactoring OpenBMC Patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1460580645-5232-6-git-send-email-openbmc-patches@stwcx.xyz \
    --to=openbmc-patches@stwcx.xyz \
    --cc=bradleyb@us.ibm.com \
    --cc=openbmc@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.