Remove stopKnownSystemdUnits() 56/187756/1
authorseolheui, kim <s414.kim@samsung.com>
Tue, 28 Aug 2018 07:17:08 +0000 (16:17 +0900)
committerseolheui, kim <s414.kim@samsung.com>
Tue, 28 Aug 2018 07:17:08 +0000 (16:17 +0900)
Change-Id: I77c23c92aa021dd54f60e442843c7ef1403390ca
Signed-off-by: seolheui, kim <s414.kim@samsung.com>
server/internal-encryption.cpp

index 9ae49e5..1947f9d 100644 (file)
@@ -133,61 +133,6 @@ void JobWatch::jobRemoved(const dbus::Variant& parameters)
        jobsCv.notify_one();
 }
 
-void stopKnownSystemdUnits()
-{
-       std::vector<std::string> knownSystemdUnits;
-       dbus::Connection& systemDBus = dbus::Connection::getSystem();
-       dbus::VariantIterator iter;
-
-       systemDBus.methodcall("org.freedesktop.systemd1",
-                                                       "/org/freedesktop/systemd1",
-                                                       "org.freedesktop.systemd1.Manager",
-                                                       "ListUnits",
-                                                       -1, "(a(ssssssouso))", "")
-                                                               .get("(a(ssssssouso))", &iter);
-
-       while (1) {
-               unsigned int dataUint;
-               char *dataStr[9];
-               int ret;
-
-               ret = iter.get("(ssssssouso)", dataStr, dataStr + 1, dataStr + 2,
-                                               dataStr + 3, dataStr + 4, dataStr + 5,
-                                               dataStr + 6, &dataUint, dataStr + 7,
-                                               dataStr + 8);
-
-               if (!ret) {
-                       break;
-               }
-
-               std::string unit(dataStr[0]);
-               if (unit == "security-manager.socket" ||
-                               unit == "connman.socket") {
-                       knownSystemdUnits.insert(knownSystemdUnits.begin(), unit);
-               } else if (unit.compare(0, 5, "user@") == 0 ||
-                       unit == "tlm.service" ||
-                       unit == "resourced.service" ||
-                       unit == "security-manager.service") {
-                       knownSystemdUnits.push_back(unit);
-               }
-       }
-
-       JobWatch watch(systemDBus);
-
-       for (const std::string& unit : knownSystemdUnits) {
-               INFO(SINK, "Stopping unit: " + unit);
-               const char* job = NULL;
-               systemDBus.methodcall("org.freedesktop.systemd1",
-                                                               "/org/freedesktop/systemd1",
-                                                               "org.freedesktop.systemd1.Manager",
-                                                               "StopUnit",
-                                                               -1, "(o)", "(ss)", unit.c_str(), "flush").get("(o)", &job);
-               INFO(SINK, "Waiting for job: " + std::string(job));
-               if (!watch.waitForJob(job))
-                       throw runtime::Exception("Stopping unit: " + unit + " failed");
-       }
-}
-
 std::string getDecodedPath(const std::string &path, const std::string &prefix)
 {
        std::string ret = path;
@@ -478,7 +423,6 @@ int InternalEncryptionServer::umount()
 
        INFO(SINK, "Closing all processes using internal storage.");
        try {
-               stopKnownSystemdUnits();
                stopDependedSystemdUnits();
                INFO(SINK, "Umounting internal storage.");
                unmountInternalStorage("/dev/mapper/userdata");
@@ -511,9 +455,6 @@ int InternalEncryptionServer::encrypt(const std::string& password, unsigned int
                        runtime::File file("/opt/etc/.odeprogress");
                        file.create(0640);
 
-                       INFO(SINK, "Closing all known systemd services that might be using internal storage.");
-                       stopKnownSystemdUnits();
-
                        std::string source = engine->getSource();
                        auto mntPaths = findMountPointsByDevice(source);
 
@@ -571,8 +512,6 @@ int InternalEncryptionServer::decrypt(const std::string& password)
                        file.create(0640);
 
                        if (engine->isMounted()) {
-                               INFO(SINK, "Closing all known systemd services that might be using internal storage.");
-                               stopKnownSystemdUnits();
                                INFO(SINK, "Closing all processes using internal storage.");
                                stopDependedSystemdUnits();