initial parsing of command line arguments for smb
authorRonnie Sahlberg <ronniesahlberg@gmail.com>
Fri, 4 Dec 2009 04:23:23 +0000 (15:23 +1100)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Fri, 4 Dec 2009 04:23:23 +0000 (15:23 +1100)
dbench.c
dbench.h
smb.c

index e4130f6a40d0630cb2e633d72da5d5a5d0888455..bf1162c10765cd32742b43c5f98a61016fb7b38a 100644 (file)
--- a/dbench.c
+++ b/dbench.c
@@ -438,6 +438,12 @@ static void process_opts(int argc, const char **argv)
                  "How many seconds of warmup to run", NULL },
                { "machine-readable", 0, POPT_ARG_NONE, &options.machine_readable, 0,
                  "Print data in more machine-readable friendly format", NULL},
+               { "smb-server",  0, POPT_ARG_STRING, &options.smb_server, 0, 
+                 "name/ip of SMB server", NULL },
+               { "smb-share",  0, POPT_ARG_STRING, &options.smb_share, 0, 
+                 "name of SMB share", NULL },
+               { "smb-user",  0, POPT_ARG_STRING, &options.smb_user, 0, 
+                 "User to authenticate as : [<domain>/]<user>%<password>", NULL },
                POPT_TABLEEND
        };
        poptContext pc;
@@ -525,6 +531,9 @@ static void process_opts(int argc, const char **argv)
        } else if (strcmp(options.backend, "iscsi") == 0) {
                extern struct nb_operations iscsi_ops;
                nb_ops = &iscsi_ops;
+       } else if (strcmp(options.backend, "smb") == 0) {
+               extern struct nb_operations smb_ops;
+               nb_ops = &smb_ops;
        } else {
                printf("Unknown backend '%s'\n", options.backend);
                exit(1);
index 361ddcfe80f31e697503fe0e838297ade0a2ff6b..fe41f1e7b9d2c5486b14841f7179abc52d8d0038 100644 (file)
--- a/dbench.h
+++ b/dbench.h
@@ -159,6 +159,9 @@ struct options {
        int iscsi_lun;
        int iscsi_port;
        int machine_readable;
+       const char *smb_server;
+       const char *smb_share;
+       const char *smb_user;
 };
 
 
diff --git a/smb.c b/smb.c
index ee304257be7a7816b2a40453ded48f631a0434bc..1b1b8dd221fe756d15281191445c9adbc7303a5d 100644 (file)
--- a/smb.c
+++ b/smb.c
 
 #define discard_const(ptr) ((void *)((intptr_t)(ptr)))
 
+static int smb_init(void)
+{
+       if (options.smb_server == NULL) {
+               printf("You must specify --smb-server=<server> with the \"smb\" backend.\n");
+               return 1;
+       }
+       if (options.smb_share == NULL) {
+               printf("You must specify --smb-share=<share> with the \"smb\" backend.\n");
+               return 1;
+       }
+       if (options.smb_user == NULL) {
+               printf("You must specify --smb-user=[<domain>/]<user>%<password> with the \"smb\" backend.\n");
+               return 1;
+       }
+
+       printf("smb_init\n");
+
+
+       return 1;
+}
+
+static void smb_setup(struct child_struct *child)
+{
+       printf("smb_setup\n");
+}
+
+static void smb_cleanup(struct child_struct *child)
+{
+       printf("smb_cleanup\n");
+}
+
+
+static struct backend_op ops[] = {
+       { NULL, NULL}
+};
+
+struct nb_operations smb_ops = {
+       .backend_name = "smbbench",
+       .init         = smb_init,
+       .setup        = smb_setup,
+       .cleanup      = smb_cleanup,
+       .ops          = ops
+};