]> rtime.felk.cvut.cz Git - frescor/frsh.git/commitdiff
dummy resource manager gained an option to accept all contracts
authorMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 17 Jun 2009 16:40:10 +0000 (18:40 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Wed, 17 Jun 2009 16:40:10 +0000 (18:40 +0200)
resources/dummy/frm_dummy.c

index 9f3a409a61db1d41a55f86225a7690f2adb1ac9b..c88c47ad7757f8a41836137972049b6e8c0a25f4 100644 (file)
@@ -68,6 +68,8 @@
 #include <stdio.h>
 #include "dummy_config.h"
 
+bool opt_accept_all = false;
+
 struct dummy_data {
        int some_data;
 };
@@ -82,6 +84,12 @@ int admission_test(struct fres_sa_scenario *scenario, void *priv, bool *schedula
 #ifdef CONFIG_RESOURCE_DUMMY_VERBOSE   
        printf("Admission test:\n");
 #endif
+
+       if (opt_accept_all) {
+               *schedulable = true;
+               return 0;
+       }
+
        data->some_data++;
 
        fres_sa_scenario_for_each_no_cancel_contract(scenario, c) {
@@ -152,6 +160,7 @@ static const struct fres_res_manager frm = {
 
 static struct option long_opts[] = {
     { "loglevel", 1, 0, 'l' },
+    { "accept-all", 0, 0, 'a' },
     { 0, 0, 0, 0}
 };
 
@@ -160,6 +169,7 @@ usage(void)
 {
        printf("usage: frm_dummy [ options ]\n");
        printf("  -l, --loglevel <number>|<domain>=<number>,...\n");
+       printf("  -a, --accept-all   Accepts all contracts\n");
 }
 
 int main(int argc, char *argv[])
@@ -169,8 +179,10 @@ int main(int argc, char *argv[])
        forb_init_attr_t attr = { .orb_id = "org.frescor.frm.dummy" };
        int  opt;
 
-       while ((opt = getopt_long(argc, argv, "l:", &long_opts[0], NULL)) != EOF) {
+       while ((opt = getopt_long(argc, argv, "al:", &long_opts[0], NULL)) != EOF) {
                switch (opt) {
+                       case 'a':
+                               opt_accept_all = true;
                        case 'l':
                                ul_log_domain_arg2levels(optarg);
                                break;