Clean up coding style issues.

BUG=chromium-os:15236
TEST=Built, ran cpplint and unit tests.

Change-Id: Iaaa14f8b369f7dbda7c07596660d78a2e7fe8b84
Reviewed-on: http://gerrit.chromium.org/gerrit/737
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
diff --git a/cros-disks-server-impl.cc b/cros-disks-server-impl.cc
index 64d4e84..2d5f3d4 100644
--- a/cros-disks-server-impl.cc
+++ b/cros-disks-server-impl.cc
@@ -2,13 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <sys/mount.h>
+
 #include <base/logging.h>
 
-#include "cros-disks-server-impl.h"
-#include "disk.h"
-#include "disk-manager.h"
-
-#include <sys/mount.h>
+#include "cros-disks/cros-disks-server-impl.h"
+#include "cros-disks/disk.h"
+#include "cros-disks/disk-manager.h"
 
 namespace cros_disks {
 
@@ -110,4 +110,4 @@
   }
 }
 
-} // namespace cros_disks
+}  // namespace cros_disks
diff --git a/cros-disks-server-impl.h b/cros-disks-server-impl.h
index adbdb7b..ef6d50a 100644
--- a/cros-disks-server-impl.h
+++ b/cros-disks-server-impl.h
@@ -2,27 +2,29 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef CROS_DISKS_SERVER_IMPL_H__
-#define CROS_DISKS_SERVER_IMPL_H__
-
-#include "cros-disks-server.h"
-#include "disk.h"
+#ifndef CROS_DISKS_SERVER_IMPL_H_
+#define CROS_DISKS_SERVER_IMPL_H_
 
 #include <string>
 #include <vector>
 
+#include "cros-disks/cros-disks-server.h"
+#include "cros-disks/disk.h"
+
 namespace cros_disks {
 
 class DiskManager;
 
-// The d-bus server for the cros-disks daemon. 
+// The d-bus server for the cros-disks daemon.
 //
 // Example Usage:
-// 
+//
 // DBus::Connection server_conn = DBus::Connection::SystemBus();
 // server_conn.request_name("org.chromium.CrosDisks");
-// CrosDisksServer* server = new(std::nothrow) CrosDisksServer(server_conn);
-// 
+// DiskManager manager;
+// CrosDisksServer* server = new(std::nothrow) CrosDisksServer(server_conn,
+//                                                             &manager);
+//
 // At this point the server should be attached to the main loop.
 //
 class CrosDisksServer : public org::chromium::CrosDisks_adaptor,
@@ -38,34 +40,33 @@
   // Unmounts a device when invoked.
   virtual void FilesystemUnmount(const std::string& device_path,
       const std::vector<std::string>& mount_options,
-      DBus::Error& error); // NOLINT
+      DBus::Error& error);  // NOLINT
 
   // Mounts a device when invoked.
   virtual std::string FilesystemMount(const std::string& device_path,
       const std::string& filesystem_type,
       const std::vector<std::string>& mount_options,
-      DBus::Error& error); // NOLINT
+      DBus::Error& error);  // NOLINT
 
   // Returns a list of device sysfs paths for all disk devices attached to
   // the system.
   virtual std::vector<std::string> EnumerateDevices(
-      DBus::Error& error); // NOLINT
+      DBus::Error& error);  // NOLINT
 
   // Returns a list of device sysfs paths for all auto-mountable disk devices
   // attached to the system. Currently, all external disk devices, which are
   // neither on the boot device nor virtual, are considered auto-mountable.
   virtual std::vector<std::string> EnumerateAutoMountableDevices(
-      DBus::Error& error); // NOLINT
+      DBus::Error& error);  // NOLINT
 
   // Returns properties of a disk device attached to the system.
   virtual DBusDisk GetDeviceProperties(const std::string& device_path,
-      DBus::Error& error); // NOLINT
+      DBus::Error& error);  // NOLINT
 
   // Emits appropriate DBus signals notifying device changes.
   void SignalDeviceChanges();
 
  private:
-
   // Returns a list of device sysfs paths for all disk devices attached to
   // the system. If auto_mountable_only is true, only auto-mountable disk
   // devices are returned.
@@ -73,6 +74,7 @@
 
   DiskManager* disk_manager_;
 };
-} // namespace cros_disks
 
-#endif // CROS_DISKS_SERVER_IMPL_H__
+}  // namespace cros_disks
+
+#endif  // CROS_DISKS_SERVER_IMPL_H_
diff --git a/disk-manager.cc b/disk-manager.cc
index a331284..4607272 100644
--- a/disk-manager.cc
+++ b/disk-manager.cc
@@ -2,24 +2,25 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "disk-manager.h"
-#include "disk.h"
-#include "udev-device.h"
-
-#include <base/logging.h>
-#include <base/scoped_ptr.h>
-#include <base/string_number_conversions.h>
-#include <base/string_util.h>
 #include <errno.h>
 #include <libudev.h>
 #include <pwd.h>
 #include <sys/mount.h>
 #include <unistd.h>
+
 #include <algorithm>
 #include <fstream>
 #include <sstream>
 #include <vector>
 
+#include <base/logging.h>
+#include <base/scoped_ptr.h>
+#include <base/string_number_conversions.h>
+#include <base/string_util.h>
+
+#include "cros-disks/disk.h"
+#include "cros-disks/disk-manager.h"
+#include "cros-disks/udev-device.h"
 
 namespace cros_disks {
 
@@ -85,7 +86,7 @@
     LOG(INFO) << "   Properties: ";
     struct udev_list_entry *property_list, *property_list_entry;
     property_list = udev_device_get_properties_list_entry(dev);
-    udev_list_entry_foreach (property_list_entry, property_list) {
+    udev_list_entry_foreach(property_list_entry, property_list) {
       const char *key = udev_list_entry_get_name(property_list_entry);
       const char *value = udev_list_entry_get_value(property_list_entry);
       LOG(INFO) << "      " << key << " = " << value;
@@ -555,4 +556,4 @@
   return unmount_ok;
 }
 
-} // namespace cros_disks
+}  // namespace cros_disks
diff --git a/disk-manager.h b/disk-manager.h
index 96c8732..f0f3291 100644
--- a/disk-manager.h
+++ b/disk-manager.h
@@ -2,12 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DISK_MANAGER_H__
-#define DISK_MANAGER_H__
+#ifndef CROS_DISKS_DISK_MANAGER_H_
+#define CROS_DISKS_DISK_MANAGER_H_
 
 #include <blkid/blkid.h>
 #include <libudev.h>
 #include <sys/types.h>
+
 #include <iostream>
 #include <map>
 #include <string>
@@ -17,9 +18,9 @@
 
 class Disk;
 
-// The DiskManager is responsible for reading device state from udev. 
-// Said changes could be the result of a udev notification or a synchronous 
-// call to enumerate the relevant storage devices attached to the system. 
+// The DiskManager is responsible for reading device state from udev.
+// Said changes could be the result of a udev notification or a synchronous
+// call to enumerate the relevant storage devices attached to the system.
 //
 // Sample Usage:
 //
@@ -37,8 +38,7 @@
   // Lists the current block devices attached to the system.
   virtual std::vector<Disk> EnumerateDisks() const;
 
-  // Reads the changes from udev. Must be called to clear the 
-  // fd.
+  // Reads the changes from udev. Must be called to clear the fd.
   bool ProcessUdevChanges(std::string *device_path, std::string *action);
 
   // Gets a device file from the cache mapping from sysfs path to device file.
@@ -109,7 +109,6 @@
   int udev_monitor_fd() const { return udev_monitor_fd_; }
 
  private:
-
   // The root udev object.
   mutable struct udev* udev_;
 
@@ -126,6 +125,6 @@
   std::map<std::string, std::string> device_file_map_;
 };
 
-} // namespace cros_disks
+}  // namespace cros_disks
 
-#endif // DISK_MANAGER_H__
+#endif  // CROS_DISKS_DISK_MANAGER_H_
diff --git a/disk-manager_unittest.cc b/disk-manager_unittest.cc
index ccefb36..bfe83c5 100644
--- a/disk-manager_unittest.cc
+++ b/disk-manager_unittest.cc
@@ -2,16 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <base/logging.h>
-#include <gtest/gtest.h>
-
 #include <sys/mount.h>
 #include <sys/types.h>
 #include <unistd.h>
+
 #include <sstream>
 
-#include "disk.h"
-#include "disk-manager.h"
+#include <base/logging.h>
+#include <gtest/gtest.h>
+
+#include "cros-disks/disk.h"
+#include "cros-disks/disk-manager.h"
 
 namespace cros_disks {
 
diff --git a/disk.cc b/disk.cc
index ee2e415..a9d4a78 100644
--- a/disk.cc
+++ b/disk.cc
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "disk.h"
+#include "cros-disks/disk.h"
 
 namespace cros_disks {
 
@@ -73,4 +73,4 @@
   return disk;
 }
 
-} // namespace cros_disks
+}  // namespace cros_disks
diff --git a/disk.h b/disk.h
index 6822b64..d3a388d 100644
--- a/disk.h
+++ b/disk.h
@@ -2,15 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef DISK_H__
-#define DISK_H__
+#ifndef CROS_DISKS_DISK_H_
+#define CROS_DISKS_DISK_H_
 
-#include <base/basictypes.h>
 #include <dbus-c++/dbus.h>  // NOLINT
+
 #include <map>
 #include <string>
 #include <vector>
 
+#include <base/basictypes.h>
+
 namespace cros_disks {
 
 typedef std::map<std::string, DBus::Variant> DBusDisk;
@@ -22,7 +24,6 @@
 // be considered thread safe.
 class Disk {
  public:
-
   Disk();
   virtual ~Disk();
   DBusDisk ToDBusFormat() const;
@@ -97,7 +98,6 @@
   }
 
  private:
-
   bool is_drive_;
   bool is_hidden_;
   bool is_mounted_;
@@ -117,7 +117,6 @@
   uint64 bytes_remaining_;
 };
 
-} // namespace cros_disks
+}  // namespace cros_disks
 
-
-#endif // DISK_H__
+#endif  // CROS_DISKS_DISK_H_
diff --git a/disks_testrunner.cc b/disks_testrunner.cc
index a375ee8..9c98f20 100644
--- a/disks_testrunner.cc
+++ b/disks_testrunner.cc
@@ -1,6 +1,7 @@
 // Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
+
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 
diff --git a/main.cc b/main.cc
index d34a9b2..93e43a0 100644
--- a/main.cc
+++ b/main.cc
@@ -4,27 +4,28 @@
 
 // A simple daemon to detect, mount, and eject removable storage devices.
 
-#include "cros-disks-server-impl.h"
-#include "disk-manager.h"
+#include <glib.h>
+#include <glib-object.h>
+#include <libudev.h>
+
+#include <dbus-c++/glib-integration.h>
+#include <dbus-c++/util.h>
 
 #include <base/basictypes.h>
 #include <base/command_line.h>
 #include <base/file_util.h>
 #include <base/string_util.h>
 #include <chromeos/syslog_logging.h>
-#include <dbus-c++/glib-integration.h>
-#include <dbus-c++/util.h>
 #include <gflags/gflags.h>
-#include <glib-object.h>
-#include <glib.h>
-#include <libudev.h>
 #include <metrics/metrics_library.h>
 
+#include "cros-disks/cros-disks-server-impl.h"
+#include "cros-disks/disk-manager.h"
 
 using cros_disks::CrosDisksServer;
 using cros_disks::DiskManager;
 
-DEFINE_bool(foreground, false, 
+DEFINE_bool(foreground, false,
             "Don't daemon()ize; run in foreground.");
 
 // Always logs to the syslog and logs to stderr if
@@ -38,10 +39,10 @@
   chromeos::InitLog(log_flags);
 }
 
-// This callback will be invoked once udev has data about 
+// This callback will be invoked once udev has data about
 // new, changed, or removed devices.
-gboolean UdevCallback(GIOChannel* source, 
-                      GIOCondition condition, 
+gboolean UdevCallback(GIOChannel* source,
+                      GIOCondition condition,
                       gpointer data) {
   CrosDisksServer* server = static_cast<CrosDisksServer*>(data);
   server->SignalDeviceChanges();
@@ -58,7 +59,7 @@
 
   SetupLogging();
 
-  if(!FLAGS_foreground) {
+  if (!FLAGS_foreground) {
     LOG(INFO) << "Daemonizing";
     PLOG_IF(FATAL, daemon(0, 0) == 1) << "daemon() failed";
   }
@@ -68,7 +69,7 @@
   CHECK(loop) << "Failed to create a GMainLoop";
 
   LOG(INFO) << "Creating the dbus dispatcher";
-  DBus::Glib::BusDispatcher* dispatcher = 
+  DBus::Glib::BusDispatcher* dispatcher =
       new(std::nothrow) DBus::Glib::BusDispatcher();
   CHECK(dispatcher) << "Failed to create a dbus-dispatcher";
   DBus::default_dispatcher = dispatcher;
diff --git a/udev-device.cc b/udev-device.cc
index 050f7d5..5a77be6 100644
--- a/udev-device.cc
+++ b/udev-device.cc
@@ -2,15 +2,17 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <base/string_number_conversions.h>
-#include <base/string_util.h>
 #include <fcntl.h>
 #include <libudev.h>
-#include <rootdev/rootdev.h>
 #include <sys/statvfs.h>
+
 #include <fstream>
 
-#include "udev-device.h"
+#include <base/string_number_conversions.h>
+#include <base/string_util.h>
+#include <rootdev/rootdev.h>
+
+#include "cros-disks/udev-device.h"
 
 namespace cros_disks {
 
diff --git a/udev-device.h b/udev-device.h
index f952f79..5c61709 100644
--- a/udev-device.h
+++ b/udev-device.h
@@ -5,12 +5,13 @@
 #ifndef CROS_DISKS_UDEV_DEVICE_H_
 #define CROS_DISKS_UDEV_DEVICE_H_
 
-#include <base/basictypes.h>
 #include <iostream>
 #include <string>
 #include <vector>
 
-#include "disk.h"
+#include <base/basictypes.h>
+
+#include "cros-disks/disk.h"
 
 struct udev_device;
 
@@ -19,7 +20,6 @@
 // A utility class that helps query information about a udev device.
 class UdevDevice {
  public:
-
   explicit UdevDevice(struct udev_device *dev);
   ~UdevDevice();
 
@@ -66,7 +66,7 @@
   Disk ToDisk() const;
 
  private:
-
+  // Checks if a string contains a "1" (as Boolean true).
   bool IsValueBooleanTrue(const char *value) const;
 
   mutable struct udev_device *dev_;
diff --git a/udev-device_unittest.cc b/udev-device_unittest.cc
index 4dcc78e..de7815c 100644
--- a/udev-device_unittest.cc
+++ b/udev-device_unittest.cc
@@ -3,12 +3,13 @@
 // found in the LICENSE file.
 
 #include <libudev.h>
+
 #include <sstream>
 
 #include <base/logging.h>
 #include <gtest/gtest.h>
 
-#include "udev-device.h"
+#include "cros-disks/udev-device.h"
 
 namespace cros_disks {
 
@@ -16,8 +17,7 @@
  public:
   UdevDeviceTest()
     : udev_(udev_new()),
-      udev_device_(NULL)
-  {
+      udev_device_(NULL) {
     SelectUdevDeviceForTest();
     if (IsUdevDeviceAvailableForTesting())
       LOG(INFO) << "A udev device is available for testing.";
@@ -60,7 +60,6 @@
   }
 
  private:
-
   void SelectUdevDeviceForTest() {
     if (udev_ == NULL)
       return;
@@ -163,7 +162,7 @@
     device.GetSizeInfo(&total_size, &remaining_size);
     LOG(INFO) << "GetSizeInfo: total=" << total_size
       << ", remaining=" << remaining_size;
-    EXPECT_TRUE(total_size > 0);
+    EXPECT_GT(total_size, 0);
   }
 }