Revision: 14217
Author: adrian.chadd
Date: Wed Jul 22 06:48:26 2009
Log: Just check that the command is 'rebuild'.


http://code.google.com/p/lusca-cache/source/detail?r=14217

Modified:
  /playpen/LUSCA_HEAD_storework/app/coss_rebuild/coss_rebuild.c

=======================================
--- /playpen/LUSCA_HEAD_storework/app/coss_rebuild/coss_rebuild.c       Mon Jul 
 
20 00:08:36 2009
+++ /playpen/LUSCA_HEAD_storework/app/coss_rebuild/coss_rebuild.c       Wed Jul 
 
22 06:48:26 2009
@@ -3,6 +3,7 @@
  #include <stdio.h>
  #include <stdlib.h>
  #include <unistd.h>
+#include <string.h>

  #include "libcore/tools.h"
  #include "libsqdebug/debug.h"
@@ -13,6 +14,20 @@

  #define       WRITE_BUFFER_LEN        65536

+typedef enum {
+        REBUILD_NONE,
+        REBUILD_DISK,
+        REBUILD_LOG
+} rebuild_type_t;
+
+static void
+usage(const char *cmd)
+{
+       printf("Usage: %s <command> <path> <block size> <stripe size> <number 
of  
stripes>\n", cmd);
+       printf("  where the block and stripe sizes are in bytes\n");
+       printf("  and <command> is, for now, 'rebuild'\n");
+}
+
  int
  main(int argc, const char *argv[])
  {
@@ -22,14 +37,21 @@
        size_t stripe_size;
        int num_stripes;
        char * wbuf = NULL;
+       rebuild_type_t r;


        if (argc < 5) {
-               printf("Usage: %s <command> <path> <block size> <stripe size> 
<number of  
stripes>\n", argv[0]);
-               printf("  where the block and stripe sizes are in bytes\n");
-               printf("  and <command> is, for now, 'rebuild'\n");
+               usage(argv[0]);
                exit(127);
        }
+       cmd = argv[1];
+
+       if (strcmp(cmd, "rebuild") == 0)
+               r = REBUILD_DISK;
+       else {
+               usage(argv[0]);
+               exit(127);
+       }

        wbuf = malloc(WRITE_BUFFER_LEN);
        if (wbuf) {
@@ -40,7 +62,6 @@
        _db_init("ALL,1");
        _db_set_stderr_debug(1);

-       cmd = argv[1];
        path = argv[2];
        block_size = atoi(argv[3]);
        stripe_size = atoi(argv[4]);

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to