<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
    <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://git.reviewboard.kde.org/r/105615/">http://git.reviewboard.kde.org/r/105615/</a>
     </td>
    </tr>
   </table>
   <br />









<div>




<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
 <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
    <a href="http://git.reviewboard.kde.org/r/105615/diff/1/?file=73285#file73285line157" style="color: black; font-weight: bold; text-decoration: underline;">solid/solid/backends/hal/halmanager.cpp</a>
    <span style="font-weight: normal;">

     (Diff revision 1)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">bool HalManager::deviceExists(const QString &udi)</pre></td>

  </tr>
 </tbody>



 
 




 <tbody>

  <tr>
    <th bgcolor="#e9eaa8" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2">154</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">        <span class="k">if</span> <span class="p">(</span><span class="n">type</span><span class="o">!=</span><span class="n">Solid</span><span class="o">::</span><span class="n">DeviceInterface</span><span class="o">::</span><span class="n">Unknown</span><span class="p">)</span> <span class="p">{</span></pre></td>
    <th bgcolor="#e9eaa8" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">157</font></th>
    <td bgcolor="#fdfebc" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">            <span class="k">if</span> <span class="p">(</span><span class="n">device</span><span class="p">.</span><span class="n">queryDeviceInterface</span><span class="p">(</span><span class="n">type</span><span class="p">)</span> <span class="o">&&</span> <span class="n">device</span><span class="p">.</span><span class="n">parentUdi</span><span class="p">()</span> <span class="o">==</span> <span class="n">parentUdi</span><span class="p">)</span> <span class="p">{</span></pre></td>
  </tr>

 </tbody>

</table>

<pre style="margin-left: 2em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">if (device.parentUdi() == parentUdi && device.queryDeviceInterface(type))

...is preferable as confronting two strings should be faster than calling queryDeviceInterface().</pre>
</div>
<br />



<p>- Alberto</p>


<br />
<p>On July 19th, 2012, 2:17 a.m., Raphael Kubo da Costa wrote:</p>






<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('http://git.reviewboard.kde.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Solid and Alberto Villa.</div>
<div>By Raphael Kubo da Costa.</div>


<p style="color: grey;"><i>Updated July 19, 2012, 2:17 a.m.</i></p>






<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
 <table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">HAL: Make devicesFromQuery more similar to the UDisks implementation.

The devicesFromQuery implementation in the UDisks backend is saner, as
it simply relays the required checks for validity to each Device we
are interested in.

So far, HalDevice::queryDeviceInterface() performed some checks
depending on the DeviceInterface type being passed to it, while
HalManager::devicesFromQuery() did not filter the results it got in
the same way. What's more, some checks such as the video4linux ones
were being made in both places, leading to some needless duplication
in functionality.

As a side-effect, this fixes a bug made visibile by a recent commit to
libktorrent: retrieving StorageAccess devices with listFromType()
would simply query HAL for devices with the "volume" capability (which
includes swap partitions and other non-mountable things), so using
Device::asDeviceInterface(Solid::DeviceInterface::StorageAccess) would
sometimes return 0 on a few of those entries retrieved earlier.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
 <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">libktorrent stopped crashing on bt::MountPoint()</pre>
  </td>
 </tr>
</table>




<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>solid/solid/backends/hal/halmanager.h <span style="color: grey">(ec42fac1d2b5dc306e9b8e00432bcbe5854a6fb9)</span></li>

 <li>solid/solid/backends/hal/halmanager.cpp <span style="color: grey">(2c9c6c0c0a8385bee37ce77d488e0395f2f90a06)</span></li>

</ul>

<p><a href="http://git.reviewboard.kde.org/r/105615/diff/" style="margin-left: 3em;">View Diff</a></p>




  </td>
 </tr>
</table>








  </div>
 </body>
</html>