* Re: [PATCH] Adding version check for plugins.
2009-03-17 13:29 ` alok barsode
@ 2009-03-14 6:14 ` Marcel Holtmann
0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2009-03-14 6:14 UTC (permalink / raw)
To: alok barsode; +Cc: Luiz Augusto von Dentz, linux-bluetooth
Hi Alok,
I did say something about top-posting, right? Never ever do that.
> Thanks for spotting them, fixed.
> Attaching the modified patch.
Patch has been applied. Thanks.
Regards
Marcel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] Adding version check for plugins.
@ 2009-03-17 10:13 alok barsode
2009-03-17 13:22 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 4+ messages in thread
From: alok barsode @ 2009-03-17 10:13 UTC (permalink / raw)
To: linux-bluetooth, Marcel Holtmann
[-- Attachment #1: Type: text/plain, Size: 153 bytes --]
Hi Marcel,
As per the discussion on IRC, I am attaching a version check patch for plugins.
Let me know if anything needs modifications.
Cheers,
Alok.
[-- Attachment #2: 0001-Adding-version-check-for-plugins.patch --]
[-- Type: text/x-diff, Size: 5051 bytes --]
From cc8b1da3701bdd29363fef4cc796de3ad6943c6a Mon Sep 17 00:00:00 2001
From: Alok Barsode <alokbarsode@gmail.com>
Date: Tue, 17 Mar 2009 15:36:14 +0530
Subject: [PATCH] Adding version check for plugins.
---
audio/main.c | 2 +-
input/main.c | 2 +-
network/main.c | 2 +-
plugins/echo.c | 2 +-
plugins/hal.c | 2 +-
plugins/netlink.c | 2 +-
plugins/service.c | 2 +-
plugins/storage.c | 2 +-
serial/main.c | 2 +-
src/main.c | 2 +-
src/plugin.c | 5 +++++
src/plugin.h | 5 +++--
12 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/audio/main.c b/audio/main.c
index 1678b58..f5eb7dd 100644
--- a/audio/main.c
+++ b/audio/main.c
@@ -171,4 +171,4 @@ static void audio_exit(void)
dbus_connection_unref(connection);
}
-BLUETOOTH_PLUGIN_DEFINE("audio", audio_init, audio_exit)
+BLUETOOTH_PLUGIN_DEFINE("audio", VERSION, audio_init, audio_exit)
diff --git a/input/main.c b/input/main.c
index 31e2ef6..010b731 100644
--- a/input/main.c
+++ b/input/main.c
@@ -82,4 +82,4 @@ static void input_exit(void)
dbus_connection_unref(connection);
}
-BLUETOOTH_PLUGIN_DEFINE("input", input_init, input_exit)
+BLUETOOTH_PLUGIN_DEFINE("input", VERSION, input_init, input_exit)
diff --git a/network/main.c b/network/main.c
index 4744185..5f96d4b 100644
--- a/network/main.c
+++ b/network/main.c
@@ -55,4 +55,4 @@ static void network_exit(void)
dbus_connection_unref(connection);
}
-BLUETOOTH_PLUGIN_DEFINE("network", network_init, network_exit)
+BLUETOOTH_PLUGIN_DEFINE("network", VERSION, network_init, network_exit)
diff --git a/plugins/echo.c b/plugins/echo.c
index 3486ef1..832bf8b 100644
--- a/plugins/echo.c
+++ b/plugins/echo.c
@@ -163,4 +163,4 @@ static void echo_exit(void)
btd_unregister_adapter_driver(&echo_server);
}
-BLUETOOTH_PLUGIN_DEFINE("echo", echo_init, echo_exit)
+BLUETOOTH_PLUGIN_DEFINE("echo", VERSION, echo_init, echo_exit)
diff --git a/plugins/hal.c b/plugins/hal.c
index f066a5a..219b46e 100644
--- a/plugins/hal.c
+++ b/plugins/hal.c
@@ -158,4 +158,4 @@ static void hal_exit(void)
btd_unregister_adapter_driver(&hal_driver);
}
-BLUETOOTH_PLUGIN_DEFINE("hal", hal_init, hal_exit)
+BLUETOOTH_PLUGIN_DEFINE("hal", VERSION, hal_init, hal_exit)
diff --git a/plugins/netlink.c b/plugins/netlink.c
index 78a18aa..f777cf9 100644
--- a/plugins/netlink.c
+++ b/plugins/netlink.c
@@ -123,4 +123,4 @@ static void netlink_exit(void)
nl_handle_destroy(handle);
}
-BLUETOOTH_PLUGIN_DEFINE("netlink", netlink_init, netlink_exit)
+BLUETOOTH_PLUGIN_DEFINE("netlink", VERSION, netlink_init, netlink_exit)
diff --git a/plugins/service.c b/plugins/service.c
index 4a87234..b4d405b 100644
--- a/plugins/service.c
+++ b/plugins/service.c
@@ -859,4 +859,4 @@ static void service_exit(void)
dbus_connection_unref(connection);
}
-BLUETOOTH_PLUGIN_DEFINE("service", service_init, service_exit)
+BLUETOOTH_PLUGIN_DEFINE("service", VERSION, service_init, service_exit)
diff --git a/plugins/storage.c b/plugins/storage.c
index 733c479..c4dbe16 100644
--- a/plugins/storage.c
+++ b/plugins/storage.c
@@ -39,4 +39,4 @@ static void storage_exit(void)
{
}
-BLUETOOTH_PLUGIN_DEFINE("storage", storage_init, storage_exit)
+BLUETOOTH_PLUGIN_DEFINE("storage", VERSION, storage_init, storage_exit)
diff --git a/serial/main.c b/serial/main.c
index bb2a28c..5db389c 100644
--- a/serial/main.c
+++ b/serial/main.c
@@ -55,4 +55,4 @@ static void serial_exit(void)
dbus_connection_unref(connection);
}
-BLUETOOTH_PLUGIN_DEFINE("serial", serial_init, serial_exit)
+BLUETOOTH_PLUGIN_DEFINE("serial", VERSION, serial_init, serial_exit)
diff --git a/src/main.c b/src/main.c
index 3c7d70b..5303444 100644
--- a/src/main.c
+++ b/src/main.c
@@ -695,7 +695,7 @@ int main(int argc, char *argv[])
umask(0077);
- start_logging("bluetoothd", "Bluetooth daemon");
+ start_logging("bluetoothd", "Bluetooth daemon %s", VERSION);
memset(&sa, 0, sizeof(sa));
sa.sa_flags = SA_NOCLDSTOP;
diff --git a/src/plugin.c b/src/plugin.c
index 4559c77..cebebfd 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -52,6 +52,11 @@ static gboolean add_plugin(void *handle, struct bluetooth_plugin_desc *desc)
if (desc->init == NULL)
return FALSE;
+
+ if (g_str_equal(desc->version, VERSION) == FALSE) {
+ DBG("version mismatch for %s", desc->name);
+ return FALSE;
+ }
plugin = g_try_new0(struct bluetooth_plugin, 1);
if (plugin == NULL)
diff --git a/src/plugin.h b/src/plugin.h
index 31bcce8..62d5f75 100644
--- a/src/plugin.h
+++ b/src/plugin.h
@@ -23,13 +23,14 @@
struct bluetooth_plugin_desc {
const char *name;
+ const char *version;
int (*init) (void);
void (*exit) (void);
};
-#define BLUETOOTH_PLUGIN_DEFINE(name,init,exit) \
+#define BLUETOOTH_PLUGIN_DEFINE(name,version,init,exit) \
extern struct bluetooth_plugin_desc bluetooth_plugin_desc \
__attribute__ ((visibility("default"))); \
struct bluetooth_plugin_desc bluetooth_plugin_desc = { \
- name, init, exit \
+ name, version, init, exit \
};
--
1.5.6.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Adding version check for plugins.
2009-03-17 10:13 [PATCH] Adding version check for plugins alok barsode
@ 2009-03-17 13:22 ` Luiz Augusto von Dentz
2009-03-17 13:29 ` alok barsode
0 siblings, 1 reply; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2009-03-17 13:22 UTC (permalink / raw)
To: alok barsode; +Cc: linux-bluetooth, Marcel Holtmann
Hi Alok,
2009/3/17 alok barsode <alokbarsode@gmail.com>:
> Hi Marcel,
>
> As per the discussion on IRC, I am attaching a version check patch for plugins.
>
> Let me know if anything needs modifications.
>
> Cheers,
> Alok.
>
There are some trailing spaces around if (g_str_equal(desc->version,
VERSION) == FALSE), could you please fix them.
--
Luiz Augusto von Dentz
Engenheiro de Computação
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Adding version check for plugins.
2009-03-17 13:22 ` Luiz Augusto von Dentz
@ 2009-03-17 13:29 ` alok barsode
2009-03-14 6:14 ` Marcel Holtmann
0 siblings, 1 reply; 4+ messages in thread
From: alok barsode @ 2009-03-17 13:29 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth, Marcel Holtmann
[-- Attachment #1: Type: text/plain, Size: 609 bytes --]
Luiz,
Thanks for spotting them, fixed.
Attaching the modified patch.
On Tue, Mar 17, 2009 at 6:52 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> Hi Alok,
>
> 2009/3/17 alok barsode <alokbarsode@gmail.com>:
>> Hi Marcel,
>>
>> As per the discussion on IRC, I am attaching a version check patch for plugins.
>>
>> Let me know if anything needs modifications.
>>
>> Cheers,
>> Alok.
>>
>
> There are some trailing spaces around if (g_str_equal(desc->version,
> VERSION) == FALSE), could you please fix them.
>
> --
> Luiz Augusto von Dentz
> Engenheiro de Computação
>
[-- Attachment #2: 0001-Adding-version-check-for-plugins.patch --]
[-- Type: text/x-diff, Size: 5061 bytes --]
From 1b09134529191d9f81a4b7f1954aa7a9b2dbca87 Mon Sep 17 00:00:00 2001
From: Alok Barsode <alokbarsode@gmail.com>
Date: Tue, 17 Mar 2009 18:56:21 +0530
Subject: [PATCH] Adding version check for plugins.
---
audio/main.c | 2 +-
input/main.c | 2 +-
network/main.c | 2 +-
plugins/echo.c | 2 +-
plugins/hal.c | 2 +-
plugins/netlink.c | 2 +-
plugins/service.c | 2 +-
plugins/storage.c | 2 +-
serial/main.c | 2 +-
src/main.c | 2 +-
src/plugin.c | 5 +++++
src/plugin.h | 5 +++--
12 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/audio/main.c b/audio/main.c
index 1678b58..f5eb7dd 100644
--- a/audio/main.c
+++ b/audio/main.c
@@ -171,4 +171,4 @@ static void audio_exit(void)
dbus_connection_unref(connection);
}
-BLUETOOTH_PLUGIN_DEFINE("audio", audio_init, audio_exit)
+BLUETOOTH_PLUGIN_DEFINE("audio", VERSION, audio_init, audio_exit)
diff --git a/input/main.c b/input/main.c
index 31e2ef6..010b731 100644
--- a/input/main.c
+++ b/input/main.c
@@ -82,4 +82,4 @@ static void input_exit(void)
dbus_connection_unref(connection);
}
-BLUETOOTH_PLUGIN_DEFINE("input", input_init, input_exit)
+BLUETOOTH_PLUGIN_DEFINE("input", VERSION, input_init, input_exit)
diff --git a/network/main.c b/network/main.c
index 4744185..5f96d4b 100644
--- a/network/main.c
+++ b/network/main.c
@@ -55,4 +55,4 @@ static void network_exit(void)
dbus_connection_unref(connection);
}
-BLUETOOTH_PLUGIN_DEFINE("network", network_init, network_exit)
+BLUETOOTH_PLUGIN_DEFINE("network", VERSION, network_init, network_exit)
diff --git a/plugins/echo.c b/plugins/echo.c
index 3486ef1..832bf8b 100644
--- a/plugins/echo.c
+++ b/plugins/echo.c
@@ -163,4 +163,4 @@ static void echo_exit(void)
btd_unregister_adapter_driver(&echo_server);
}
-BLUETOOTH_PLUGIN_DEFINE("echo", echo_init, echo_exit)
+BLUETOOTH_PLUGIN_DEFINE("echo", VERSION, echo_init, echo_exit)
diff --git a/plugins/hal.c b/plugins/hal.c
index f066a5a..219b46e 100644
--- a/plugins/hal.c
+++ b/plugins/hal.c
@@ -158,4 +158,4 @@ static void hal_exit(void)
btd_unregister_adapter_driver(&hal_driver);
}
-BLUETOOTH_PLUGIN_DEFINE("hal", hal_init, hal_exit)
+BLUETOOTH_PLUGIN_DEFINE("hal", VERSION, hal_init, hal_exit)
diff --git a/plugins/netlink.c b/plugins/netlink.c
index 78a18aa..f777cf9 100644
--- a/plugins/netlink.c
+++ b/plugins/netlink.c
@@ -123,4 +123,4 @@ static void netlink_exit(void)
nl_handle_destroy(handle);
}
-BLUETOOTH_PLUGIN_DEFINE("netlink", netlink_init, netlink_exit)
+BLUETOOTH_PLUGIN_DEFINE("netlink", VERSION, netlink_init, netlink_exit)
diff --git a/plugins/service.c b/plugins/service.c
index 4a87234..b4d405b 100644
--- a/plugins/service.c
+++ b/plugins/service.c
@@ -859,4 +859,4 @@ static void service_exit(void)
dbus_connection_unref(connection);
}
-BLUETOOTH_PLUGIN_DEFINE("service", service_init, service_exit)
+BLUETOOTH_PLUGIN_DEFINE("service", VERSION, service_init, service_exit)
diff --git a/plugins/storage.c b/plugins/storage.c
index 733c479..c4dbe16 100644
--- a/plugins/storage.c
+++ b/plugins/storage.c
@@ -39,4 +39,4 @@ static void storage_exit(void)
{
}
-BLUETOOTH_PLUGIN_DEFINE("storage", storage_init, storage_exit)
+BLUETOOTH_PLUGIN_DEFINE("storage", VERSION, storage_init, storage_exit)
diff --git a/serial/main.c b/serial/main.c
index bb2a28c..5db389c 100644
--- a/serial/main.c
+++ b/serial/main.c
@@ -55,4 +55,4 @@ static void serial_exit(void)
dbus_connection_unref(connection);
}
-BLUETOOTH_PLUGIN_DEFINE("serial", serial_init, serial_exit)
+BLUETOOTH_PLUGIN_DEFINE("serial", VERSION, serial_init, serial_exit)
diff --git a/src/main.c b/src/main.c
index 3c7d70b..5303444 100644
--- a/src/main.c
+++ b/src/main.c
@@ -695,7 +695,7 @@ int main(int argc, char *argv[])
umask(0077);
- start_logging("bluetoothd", "Bluetooth daemon");
+ start_logging("bluetoothd", "Bluetooth daemon %s", VERSION);
memset(&sa, 0, sizeof(sa));
sa.sa_flags = SA_NOCLDSTOP;
diff --git a/src/plugin.c b/src/plugin.c
index 4559c77..051c33c 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -53,6 +53,11 @@ static gboolean add_plugin(void *handle, struct bluetooth_plugin_desc *desc)
if (desc->init == NULL)
return FALSE;
+ if (g_str_equal(desc->version, VERSION) == FALSE) {
+ DBG("version mismatch for %s", desc->name);
+ return FALSE;
+ }
+
plugin = g_try_new0(struct bluetooth_plugin, 1);
if (plugin == NULL)
return FALSE;
diff --git a/src/plugin.h b/src/plugin.h
index 31bcce8..62d5f75 100644
--- a/src/plugin.h
+++ b/src/plugin.h
@@ -23,13 +23,14 @@
struct bluetooth_plugin_desc {
const char *name;
+ const char *version;
int (*init) (void);
void (*exit) (void);
};
-#define BLUETOOTH_PLUGIN_DEFINE(name,init,exit) \
+#define BLUETOOTH_PLUGIN_DEFINE(name,version,init,exit) \
extern struct bluetooth_plugin_desc bluetooth_plugin_desc \
__attribute__ ((visibility("default"))); \
struct bluetooth_plugin_desc bluetooth_plugin_desc = { \
- name, init, exit \
+ name, version, init, exit \
};
--
1.5.6.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-03-17 13:29 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-17 10:13 [PATCH] Adding version check for plugins alok barsode
2009-03-17 13:22 ` Luiz Augusto von Dentz
2009-03-17 13:29 ` alok barsode
2009-03-14 6:14 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox