[PVFS2-CVS]
commit by neill in pvfs2/test/client/sysint: initialize-dyn.c
module.mk.in
CVS commit program
cvs at parl.clemson.edu
Fri Mar 19 18:50:56 EST 2004
Update of /projects/cvsroot/pvfs2/test/client/sysint
In directory parlweb:/tmp/cvs-serv16369/test/client/sysint
Modified Files:
module.mk.in
Added Files:
initialize-dyn.c
Log Message:
- add a first draft cut of the ability to dynamically add and remove
mount entries to the system
- add a simple test program that removes and adds some mount entries -- only
useful if you have a carefully crafted setup (as I do)
- this *might* work, but needs more testing and work
--- /dev/null 2003-01-30 05:24:37.000000000 -0500
+++ initialize-dyn.c 2004-03-19 18:50:56.000000000 -0500
@@ -0,0 +1,97 @@
+/*
+ * (C) 2001 Clemson University and The University of Chicago
+ *
+ * See COPYING in top-level directory.
+ */
+
+#include <sys/time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "client.h"
+#include "pvfs2-util.h"
+
+#define MAX_NUM_MNT 3
+
+/*
+ works with a pvfs2tab file that looks like:
+
+tcp://localhost:3334/pvfs2-volume1 /mnt/pvfs pvfs2 encoding=le_bfield 0 0
+tcp://localhost:3334/pvfs2-volume2 /mnt/pvfs2 pvfs2 encoding=le_bfield 0 0
+tcp://localhost:3334/pvfs2-volume3 /mnt/pvfs3 pvfs2 encoding=le_bfield 0 0
+
+ and of course with a running server that has these volumes initialized.
+*/
+
+int main(int argc, char **argv)
+{
+ int ret = -1;
+ int i = 0;
+ struct PVFS_sys_mntent mntent[MAX_NUM_MNT] =
+ {
+ { "tcp://localhost:3334", "pvfs2-volume1", 0, 0, 9,
+ "/mnt/pvfs", "default" },
+ { "tcp://localhost:3334", "pvfs2-volume2", 0, 0, 10,
+ "/mnt/pvfs2", "default" },
+ { "tcp://localhost:3334", "pvfs2-volume3", 0, 0, 11,
+ "/mnt/pvfs3", "default" },
+ };
+
+ ret = PVFS_util_init_defaults();
+ if (ret < 0)
+ {
+ PVFS_perror("PVFS_util_init_defaults", ret);
+ return (-1);
+ }
+
+ printf("*** All defaults initialized\n");
+
+ /* remove the mount points */
+ for(i = 0; i < MAX_NUM_MNT; i++)
+ {
+ printf("Removing mount entry %d: %s\n",
+ i, mntent[i].mnt_dir);
+ ret = PVFS_sys_fs_remove(&mntent[i]);
+ if (ret)
+ {
+ printf("Failed to remove mount entry %d\n",i);
+ PVFS_perror("Error", ret);
+ break;
+ }
+ }
+
+ /* TODO: do something that will fail here */
+
+ /* re-add the mount points */
+ for(i = 0; i < MAX_NUM_MNT; i++)
+ {
+ printf("Adding dynamic mount entry %d: %s\n",
+ i, mntent[i].mnt_dir);
+ ret = PVFS_sys_fs_add(&mntent[i]);
+ if (ret)
+ {
+ printf("Failed to add mount entry %d\n",i);
+ PVFS_perror("Error", ret);
+ break;
+ }
+ }
+
+ /* TODO: do something that should pass again here */
+
+ ret = PVFS_sys_finalize();
+ if (ret < 0)
+ {
+ printf("finalizing sysint failed with errcode = %d\n", ret);
+ return (-1);
+ }
+
+ return (0);
+}
+
+/*
+ * Local variables:
+ * c-indent-level: 4
+ * c-basic-offset: 4
+ * End:
+ *
+ * vim: ts=8 sts=4 sw=4 noexpandtab
+ */
Index: module.mk.in
===================================================================
RCS file: /projects/cvsroot/pvfs2/test/client/sysint/module.mk.in,v
diff -p -u -r1.39 -r1.40
--- module.mk.in 12 Nov 2003 15:38:40 -0000 1.39
+++ module.mk.in 19 Mar 2004 23:50:56 -0000 1.40
@@ -25,4 +25,5 @@ TESTSRC += \
$(DIR)/io-test.c \
$(DIR)/io-test-offset.c \
$(DIR)/initialize.c \
+ $(DIR)/initialize-dyn.c \
$(DIR)/getparent.c
More information about the PVFS2-CVS
mailing list