core: Remove unused device-idler files 14/141514/3
authorWook Song <wook16.song@samsung.com>
Tue, 1 Aug 2017 02:10:15 +0000 (11:10 +0900)
committerWook Song <wook16.song@samsung.com>
Fri, 4 Aug 2017 00:21:59 +0000 (09:21 +0900)
The functions in the device-idler source and header files are not used
outside of them. Therefore, this patch removes these files and excludes
them from the build of PASS.

Change-Id: I78c3b39f898edf23ebe6da7625c7d4ff455bf98b
Signed-off-by: Wook Song <wook16.song@samsung.com>
CMakeLists.txt
src/core/device-idler.c [deleted file]
src/core/device-idler.h [deleted file]
src/core/edbus-handler.c

index 54b8036..3976d54 100644 (file)
@@ -76,7 +76,6 @@ SET(SRCS
        src/shared/pass-systemd.c
        src/core/common.c
        src/core/config-parser.c
-       src/core/device-idler.c
        src/core/device-notifier.c
        src/core/devices.c
        src/core/edbus-handler.c
diff --git a/src/core/device-idler.c b/src/core/device-idler.c
deleted file mode 100644 (file)
index edca042..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * PASS
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#include <Ecore.h>
-#include <glib.h>
-#include <errno.h>
-
-#include "shared/log.h"
-
-struct device_request {
-       void (*func)(void *data);
-       void *data;
-};
-
-static GQueue req_queue = G_QUEUE_INIT;
-static Ecore_Idler *idler;
-
-static int free_request(struct device_request *req)
-{
-       if (!req)
-               return -EINVAL;
-
-       free(req);
-       return 0;
-}
-
-static Eina_Bool idler_cb(void *data)
-{
-       struct device_request *req;
-
-       req = g_queue_pop_head(&req_queue);
-       if (req) {
-               if (req->func)
-                       req->func(req->data);
-               free_request(req);
-       }
-
-       if (g_queue_is_empty(&req_queue)) {
-               idler = NULL;
-               return ECORE_CALLBACK_CANCEL;
-       }
-
-       return ECORE_CALLBACK_RENEW;
-}
-
-static void process_next_request_in_idle(void)
-{
-       if (g_queue_is_empty(&req_queue))
-               return;
-
-       if (idler)
-               return;
-
-       idler = ecore_idler_add(idler_cb, NULL);
-       /**
-        * if idler is null,
-        * it means whole system might be an abnormal state.
-        * so it just prints out error log.
-        */
-       if (!idler)
-               _E("fail to add request to idler");
-}
-
-int add_idle_request(void (*func)(void *data), void *data)
-{
-       struct device_request *req;
-
-       if (!func) {
-               _E("invalid argumet : func(NULL)");
-               return -EINVAL;
-       }
-
-       req = calloc(1, sizeof(struct device_request));
-       if (!req) {
-               _E("fail to allocate request : %d", errno);
-               return -errno;
-       }
-
-       req->func = func;
-       req->data = data;
-
-       g_queue_push_tail(&req_queue, req);
-       process_next_request_in_idle();
-
-       return 0;
-}
diff --git a/src/core/device-idler.h b/src/core/device-idler.h
deleted file mode 100644 (file)
index c3efc03..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * PASS
- *
- * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#ifndef __DEVICE_IDLER_H__
-#define __DEVICE_IDLER_H__
-
-/*
- * To allow for callbacks to be called when the daemon is idle state.
- */
-
-int add_idle_request(void (*func)(void *data), void *data);
-
-#endif /* __DEVICE_IDLER_H__ */
index cb3f2f7..61c1cea 100644 (file)
@@ -21,7 +21,6 @@
 
 #include "core/edbus-handler.h"
 #include "core/common.h"
-#include "core/device-idler.h"
 #include "core/device-notifier.h"
 #include "core/list.h"
 #include "shared/log.h"