From 15ad5531b091d58ea0dc6ccd6e15c5eb079982be Mon Sep 17 00:00:00 2001 From: "roberto@goyle" Date: Tue, 31 Jan 2012 10:54:29 +0100 Subject: [PATCH] another series of updates --- plugins/erlang/erlang.c | 24 ++++-------------------- plugins/fiber/fiber.c | 5 ----- plugins/gevent/gevent.c | 5 ----- plugins/greenlet/greenlet.c | 6 +++--- plugins/lua/lua_plugin.c | 2 +- plugins/stackless/stackless.c | 4 ++-- 6 files changed, 10 insertions(+), 36 deletions(-) diff --git a/plugins/erlang/erlang.c b/plugins/erlang/erlang.c index a1198057..e880fe13 100644 --- a/plugins/erlang/erlang.c +++ b/plugins/erlang/erlang.c @@ -4,10 +4,10 @@ extern struct uwsgi_server uwsgi; struct uwsgi_erlang uerl; -struct option erlang_options[] = { - {"erlang", required_argument, 0, LONG_ARGS_ERLANG}, - {"erlang-cookie", required_argument, 0, LONG_ARGS_ERLANG_COOKIE}, - {0, 0, 0, 0}, +struct uwsgi_option erlang_options[] = { + {"erlang", required_argument, 0, "spawn an erlang c-node", uwsgi_opt_set_str, &uerl.name, UWSGI_OPT_MASTER}, + {"erlang-cookie", required_argument, 0, "set erlang cookie", uwsgi_opt_set_str, &uerl.cookie, 0}, + {0, 0, 0, 0, 0, 0, 0}, }; @@ -433,26 +433,10 @@ int erlang_init() { return 0; } -int erlang_opt(int i, char *optarg) { - - switch(i) { - case LONG_ARGS_ERLANG: - uwsgi.master_process = 1; - uerl.name = optarg; - return 1; - case LONG_ARGS_ERLANG_COOKIE: - uerl.cookie = optarg; - return 1; - } - return 0; -} - - struct uwsgi_plugin erlang_plugin = { .name = "erlang", .options = erlang_options, - .manage_opt = erlang_opt, .init = erlang_init, }; diff --git a/plugins/fiber/fiber.c b/plugins/fiber/fiber.c index 63ea3210..854a13dd 100644 --- a/plugins/fiber/fiber.c +++ b/plugins/fiber/fiber.c @@ -7,10 +7,6 @@ struct ufib { VALUE *fib; } ufiber; -struct option fiber_options[] = { - { 0, 0, 0, 0 } -}; - VALUE uwsgi_fiber_request() { uwsgi.wsgi_req->async_status = uwsgi.p[uwsgi.wsgi_req->uh.modifier1]->request(uwsgi.wsgi_req); @@ -80,5 +76,4 @@ struct uwsgi_plugin fiber_plugin = { .name = "fiber", .init = fiber_init, - .options = fiber_options, }; diff --git a/plugins/gevent/gevent.c b/plugins/gevent/gevent.c index ec622a93..37e3df93 100644 --- a/plugins/gevent/gevent.c +++ b/plugins/gevent/gevent.c @@ -3,10 +3,6 @@ extern struct uwsgi_server uwsgi; extern struct uwsgi_python up; -struct option gevent_options[] = { - { 0, 0, 0, 0 } -}; - #define GEVENT_SWITCH PyObject *gswitch = python_call(ugevent.greenlet_switch, ugevent.greenlet_switch_args, 0, NULL); Py_DECREF(gswitch) #define GET_CURRENT_GREENLET python_call(ugevent.get_current, ugevent.get_current_args, 0, NULL) #define free_req_queue uwsgi.async_queue_unused_ptr++; uwsgi.async_queue_unused[uwsgi.async_queue_unused_ptr] = uwsgi.wsgi_req @@ -352,5 +348,4 @@ struct uwsgi_plugin gevent_plugin = { .name = "gevent", .init = gevent_init, - .options = gevent_options, }; diff --git a/plugins/greenlet/greenlet.c b/plugins/greenlet/greenlet.c index b38c02a8..99326829 100644 --- a/plugins/greenlet/greenlet.c +++ b/plugins/greenlet/greenlet.c @@ -10,9 +10,9 @@ struct ugreenlet { PyGreenlet **gl; } ugl; -struct option greenlet_options[] = { - {"greenlet", no_argument, &ugl.enabled, 1}, - { 0, 0, 0, 0 } +struct uwsgi_option greenlet_options[] = { + {"greenlet", no_argument, 0, "enable greenlet as suspend engine", uwsgi_opt_true, &ugl.enabled, 0}, + { 0, 0, 0, 0, 0, 0, 0 } }; PyObject *py_uwsgi_greenlet_request(PyObject * self, PyObject *args) { diff --git a/plugins/lua/lua_plugin.c b/plugins/lua/lua_plugin.c index f3fb186c..46ed30cd 100644 --- a/plugins/lua/lua_plugin.c +++ b/plugins/lua/lua_plugin.c @@ -14,7 +14,7 @@ struct uwsgi_lua { #define lca(L, n) ulua_check_args(L, __FUNCTION__, n) -struct option uwsgi_lua_options[] = { +struct uwsgi_option uwsgi_lua_options[] = { {"lua", required_argument, 0, "load lua wsapi app", uwsgi_opt_set_str, &uwsgi.ulua.filename, 0}, diff --git a/plugins/stackless/stackless.c b/plugins/stackless/stackless.c index d5c9a140..3ab72cc1 100644 --- a/plugins/stackless/stackless.c +++ b/plugins/stackless/stackless.c @@ -9,8 +9,8 @@ struct ustackless { PyTaskletObject **sl; } usl; -struct option stackless_options[] = { - {"stackless", no_argument, &usl.enabled, 1}, +struct uwsgi_option stackless_options[] = { + {"stackless", no_argument, 0, "use stackless as suspend engine", uwsgi_opt_true, &usl.enabled, 0}, { 0, 0, 0, 0 } };