aboutsummaryrefslogtreecommitdiff
path: root/mpiosh/callback.c
diff options
context:
space:
mode:
authorcrunchy <crunchy>2003-06-27 12:21:21 +0000
committercrunchy <crunchy>2003-06-27 12:21:21 +0000
commitc6c22c4fadb3000453389f3ecf471392674adfd1 (patch)
tree8e9b5720b0c8474226dae99decfbd4c82f657d8d /mpiosh/callback.c
parent021de49f8e3d1c3b9f8e6e13df0ee7f2552c7b7a (diff)
downloadmpiosh-c6c22c4fadb3000453389f3ecf471392674adfd1.tar.gz
mpiosh-c6c22c4fadb3000453389f3ecf471392674adfd1.tar.bz2
mpiosh-c6c22c4fadb3000453389f3ecf471392674adfd1.zip
add backup and restore commands; little bug fix and clean up. Need to be tested! Just give me 5 minutes, please!
Diffstat (limited to 'mpiosh/callback.c')
-rw-r--r--mpiosh/callback.c93
1 files changed, 92 insertions, 1 deletions
diff --git a/mpiosh/callback.c b/mpiosh/callback.c
index 70c2e5a..daf99a0 100644
--- a/mpiosh/callback.c
+++ b/mpiosh/callback.c
@@ -2,7 +2,7 @@
*
* Author: Andreas Büsching <crunchy@tzi.de>
*
- * $Id: callback.c,v 1.42 2003/06/26 19:53:58 germeier Exp $
+ * $Id: callback.c,v 1.43 2003/06/27 12:21:21 crunchy Exp $
*
* Copyright (C) 2001 Andreas Büsching <crunchy@tzi.de>
*
@@ -834,6 +834,96 @@ mpiosh_cmd_health(char *args[])
}
void
+mpiosh_cmd_backup(char *args[])
+{
+ int size;
+ char filename[ 1024 ];
+
+ UNUSED(args);
+
+ MPIOSH_CHECK_CONNECTION_CLOSED;
+
+ if ( !mpiosh_config_check_backup_dir( mpiosh.config, TRUE ) ) {
+ fprintf( stderr, "error: could not create backup directory: %s\n",
+ CONFIG_BACKUP );
+ return;
+ }
+
+ snprintf( filename, 1024, "%s%s", CONFIG_BACKUP, MPIO_CONFIG_FILE );
+ size = mpio_file_get_as( mpiosh.dev, MPIO_INTERNAL_MEM,
+ MPIO_CONFIG_FILE,
+ filename,
+ mpiosh_callback_get );
+ if ( size == -1 ) return;
+ if ( !size )
+ debugn (1, "file does not exist: %s\n", MPIO_CONFIG_FILE );
+
+ snprintf( filename, 1024, "%s%s", CONFIG_BACKUP, MPIO_CHANNEL_FILE );
+ size = mpio_file_get_as( mpiosh.dev, MPIO_INTERNAL_MEM,
+ MPIO_CHANNEL_FILE,
+ filename,
+ mpiosh_callback_get );
+ if ( size == -1 ) return;
+ if ( !size )
+ debugn (2, "file does not exist: %s\n", MPIO_CHANNEL_FILE );
+
+ snprintf( filename, 1024, "%s%s", CONFIG_BACKUP, MPIO_FONT_FON );
+ size = mpio_file_get_as( mpiosh.dev, MPIO_INTERNAL_MEM,
+ MPIO_FONT_FON,
+ filename,
+ mpiosh_callback_get );
+ if ( size == -1 ) return;
+ if ( !size )
+ debugn (2, "file does not exist: %s\n", MPIO_FONT_FON );
+}
+
+void
+mpiosh_cmd_restore(char *args[])
+{
+ int size;
+ char filename[ 1024 ];
+
+ UNUSED(args);
+
+ MPIOSH_CHECK_CONNECTION_CLOSED;
+
+ if ( !mpiosh_config_check_backup_dir( mpiosh.config, FALSE ) ) {
+ fprintf( stderr, "error: there is no backup: %s\n",
+ CONFIG_BACKUP );
+ return;
+ }
+
+ snprintf( filename, 1024, "%s%s", CONFIG_BACKUP, MPIO_CONFIG_FILE );
+ size = mpio_file_put_as( mpiosh.dev, MPIO_INTERNAL_MEM,
+ filename,
+ MPIO_CONFIG_FILE,
+ FTYPE_CONF, mpiosh_callback_put );
+ if ( size == -1 ) return;
+ if ( !size )
+ debugn (1, "file does not exist: %s\n", MPIO_CONFIG_FILE );
+
+ snprintf( filename, 1024, "%s%s", CONFIG_BACKUP, MPIO_CHANNEL_FILE );
+ size = mpio_file_put_as( mpiosh.dev, MPIO_INTERNAL_MEM,
+ filename,
+ MPIO_CHANNEL_FILE,
+ FTYPE_CHAN, mpiosh_callback_put );
+ if ( size == -1 ) return;
+ if ( !size )
+ debugn (2, "file does not exist: %s\n", MPIO_CHANNEL_FILE );
+
+ snprintf( filename, 1024, "%s%s", CONFIG_BACKUP, MPIO_FONT_FON );
+ size = mpio_file_put_as( mpiosh.dev, MPIO_INTERNAL_MEM,
+ filename,
+ MPIO_FONT_FON,
+ FTYPE_FONT, mpiosh_callback_put );
+ if ( size == -1 ) return;
+ if ( !size )
+ debugn (2, "file does not exist: %s\n", MPIO_FONT_FON );
+}
+
+
+#if 0
+void
mpiosh_cmd_config(char *args[])
{
BYTE *config_data;
@@ -906,6 +996,7 @@ mpiosh_cmd_config(char *args[])
printf("config [read|write|show] <\n");
}
}
+#endif
void
mpiosh_cmd_channel(char *args[])