+++ /dev/null
-/*
- * storaged
- * 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.
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <dbus/dbus.h>
-#include <stdbool.h>
-#include <limits.h>
-#include <libsyscommon/libgdbus.h>
-#include "fd_handler.h"
-#include "log.h"
-
-/* -1 is a default timeout value, it's converted to 25*1000 internally. */
-#define DBUS_REPLY_TIMEOUT (-1)
-
-int set_dbus_connection(const char *bus)
-{
- static DBusConnection *conn;
- static int already;
- DBusError err;
- int ret;
-
- if (conn && already)
- return 0;
-
- dbus_error_init(&err);
-
- conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
- if (!conn) {
- if (dbus_error_is_set(&err)) {
- _E("dbus_bus_get error(%s, %s)", err.name, err.message);
- dbus_error_free(&err);
- } else
- _E("dbus_bus_get error");
- return -ECOMM;
- }
-
- if (!already) {
- already = 1;
- dbus_error_init(&err);
-
- ret = dbus_bus_request_name(conn, bus,
- DBUS_NAME_FLAG_REPLACE_EXISTING | DBUS_NAME_FLAG_DO_NOT_QUEUE,
- &err);
- if (ret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
- if (dbus_error_is_set(&err)) {
- _E("Failed to request dbus name(%s err.name=%s err.message=%s).", bus, err.name, err.message);
- dbus_error_free(&err);
- } else
- _E("Failed to request dbus name(%s).", bus);
- return -ECOMM;
- }
- }
-
- return 0;
-}
+++ /dev/null
-/*
- * storaged
- * 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 __STORAGED_DBUS_MAIN_H__
-#define __STORAGED_DBUS_MAIN_H__
-
-#include <libsyscommon/libgdbus.h>
-
-int set_dbus_connection(const char *bus);
-
-#endif /* __STORAGED_BUS_MAIN_H__ */